www.pudn.com > digitalimageprocessprograms.rar > lena.m


clc; 
fid=fopen('d:/img/lena.img','r'); 
f=fread(fid,[256,256],'uchar'); 
subplot(2,1,1); 
imshow(f,[0,255]); 
h=fft2(f); 
H=abs(h); 
H0=15*log(1.001+H); 
subplot(2,1,2); 
imshow(H0,[0,255]); 
 
 
figure; 
h1=fftshift(h); 
r=88; 
h2=h1; 
for x=1:256 
    for y=1:256 
        if (x-128).^2+(y-128).^2>r.^2 
            h2(x,y)=0; 
        end 
    end 
end 
H2=abs(h2); 
H02=15*log(1.001+H2); 
imshow(H02,[0,255]); 
f2=ifft2(h2); 
figure; 
imshow(f2,[0,255]); 
 
figure; 
h3=h1;r=40; 
for x=1:256 
    for y=1:256 
        if (x-128).^2+(y-128).^2