%%
I= imread('H.jpg') ;
I1=rgb2gray(I);
I1=im2double(I1);
I1=fft2(I1); %傅里叶变换
I2=fftshift(I1);
[m,n]=size(I2);
d1=min(m,n);
figure;
for d0=5:5:80;%[1:d1];
m1=fix(m/2);
n1=fix(n/2);
img_lpf=zeros(m,n);
for i=1:m
for j=1:n
d=sqrt((i-m1)^2+(j-n1)^2); %lixiangditonglvbo qiujuli
if d<=d0
h(i,j)=1;
else
h(i,j)=0;
end
img1(i,j)=h(i,j)*I2(i,j);
end
end
img2=log(abs(img1)+1);
imshow(img2,[]);
end
title('低通滤波后傅里叶变换图'); %xianshitupian
img3=ifftshift(img1); %fanfuliyebianhuan
img3=ifft2(img3); %qushishubufen
I= imread('H.jpg') ;
I1=rgb2gray(I);
I1=im2double(I1);
I1=fft2(I1); %傅里叶变换
I2=fftshift(I1);
[m,n]=size(I2);
d1=min(m,n);
figure;
for d0=5:5:80;%[1:d1];
m1=fix(m/2);
n1=fix(n/2);
img_lpf=zeros(m,n);
for i=1:m
for j=1:n
d=sqrt((i-m1)^2+(j-n1)^2); %lixiangditonglvbo qiujuli
if d<=d0
h(i,j)=1;
else
h(i,j)=0;
end
img1(i,j)=h(i,j)*I2(i,j);
end
end
img2=log(abs(img1)+1);
imshow(img2,[]);
end
title('低通滤波后傅里叶变换图'); %xianshitupian
img3=ifftshift(img1); %fanfuliyebianhuan
img3=ifft2(img3); %qushishubufen