%A为给定图像,归一化到[0,1]的矩阵 %W为双边滤波器(核)的边长/2 function B = bfilter2(A,w,sigma)% Pre-process input and select appropriate filter. % Verify that the input image exists and is valid. if~exist('A','var') || isempty(A)
N=512; A=zeros(N,N); B=zeros(N,N); for I=1:1:256 J=1:1:256 ImageNum=double(Image(I,J,1)); A(I,J)=ImageNum/255; B(I,J)=0; end end figure; imshow(A); pi=3.1415926; for I=1:1:N for J=1:1:N R=rand(1,1);%生成一个元素在0,1之间均匀分布的随机矩阵R B(I,J)=A(I,J)*sin(R*2*pi);%