📄 96-04-22.m
字号:
%96-04-21
clear all;
f=imread('g:\image\cameraman.tif');
f=im2double(f);
f1=imnoise(double(f),'gaussian');
f2=imnoise(f,'salt & pepper');
figure;
[b1,c,r]=roipoly(f1);
[h1,npix]=histroi(f1,c,r);
[b2,c,r]=roipoly(f2);
[h2,npix]=histroi(f1,c,r);
[v,unv]=statmoments(h1,2);
[v2,unv2]=statmoments(h2,2);
F1=fft2(f1);
PQ1=paddedsize(size(F1));
D0=round(unv(1));
g1w=lpfilter('gaussian',PQ1(1),PQ1(2),D0);
g1=dftfilt(f1,g1w);
F2=fft2(f2);
PQ2=paddedsize(size(F2));
D1=round(unv2(1));
g2w=lpfilter('gaussian',PQ2(1),PQ2(2),D1);
g2=dftfilt(f2,g2w);
figure;
subplot(2,4,1);
imshow(f1,[])
subplot(2,4,2);
imshow(b1);
subplot(2,4,3);
bar(h1)
subplot(2,4,4);
imshow(g1,[])
subplot(2,4,5);
imshow(f2)
subplot(2,4,6);
imshow(b2)
subplot(2,4,7);
bar(h2)
subplot(2,4,8)
imshow(abs(g2),[])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -