I=imread('D:\matlab7\bin\图片9.png');
I=rgb2gray(I);
J=imnoise(I,'gaussian',0,0.005);
subplot(2,3,1);
imshow(I);
title('原图');
subplot(2,3,2);
imshow(J);
title('加噪图像');
K1=filter2(fspecial('average',3),J)/255;
K2=filter2(fspecial('average',5),J)/255;
K3=filter2(fspecial('average',7),J)/255;
K4=filter2(fspecial('average',9),J)/255;
subplot(2,3,3);
imshow(K1);
title('3*3均值滤波');
subplot(2,3,4);
imshow(K2);
title('5*5均值滤波');
subplot(2,3,5);
imshow(K3);
title('7*7均值滤波');
subplot(2,3,6);
imshow(K4);
title('9*9均值滤波');
K=medfilt2(J);
figure
subplot(1,3,1)
imshow(I);
title('原图');
subplot(1,3,2)
imshow(J);
title('加噪图像');
subplot(1,3,3)
imshow(K);
title('中值滤波')
评论0