matlab中如何对图像作理想高通滤波处理?
I=imread('cameraman.tif');figure(1);imshow(I);J=imnoise(I,'gaussian',0,0.02); figure(2);imshow(J);J=double(J);f=fft2(J); %采用傅里叶变换g=fftshift(f); %数据局陈平衡[M,N]=size(f);n1=floor(M/2);n2=floor(N/2);d0=10;for i=1:Mfor j=1:Nd=sqrt((i-n1)^2+(j-n2)^2);if d>=d0h1=1;h2=1+0.5;elseh1=0;h2=0.5;endg1(i,j)=h1*g(i,j);g2(i,j)=h2*g(i,j);endendg1=ifftshift(g1);g1=uint8(real(ifft2(g1))); %显示理想高通滤波结果figure(3);imshow(g1);title('理想高通滤波结果')g2=ifftshift(g2);g2=uint8(real(ifft2(g2)));figure(4);imshow(g2); %显示理想高通加强滤波结果title('理想高通加强滤波结果')