?? ditong.m
字號(hào):
I1=imread('C:\Documents and Settings\lishurui\桌面\DRAGON_256_1.bmp');
subplot(2,2,1);
imshow(I1);
title('原始圖像');
I2=imnoise(I1,'salt & pepper',0.02);
subplot(2,2,2);
imshow(I2);
title('噪聲圖像');
f=double(I2);
g=fft2(f);
g=fftshift(g);
[N1,N2]=size(g);
n=2;
d0=10;
n1=fix(N1/2);
n2=fix(N2/2);
for i=1:N1
for j=2:N2
d=sqrt((i-n1)^2+(j-n2)^2);
h=1/(1+0.414*(d0/d)^(2*n));
result1(i,j)=h*g(i,j);
if(g(i,j)>10)
result2(i,j)=0;
else
result2(i,j)=g(i,j);
end
end
end
result1=ifftshift(result1);
result2=ifftshift(result1);
X2=ifft2(result1);
X3=uint8(real(X2));
subplot(2,2,3)
imshow(X3);
title('Butterworth濾波圖像');
X4=ifft2(result2);
X5=uint8(real(X4));
subplot(2,2,4)
imshow(X5);
title('理想低通濾波圖像');
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -