图像滤波处理对比

%中值滤波
I0=imread('photo.jpeg');
j=rgb2gray(I0);
I = imnoise(j,'salt & pepper');
Z1=medfilt2(I,[3,3]);
Z2=medfilt2(I,[5,5]);
figure;
subplot(1,3,1),imshow(I),title('原图');
subplot(1,3,2),imshow(Z1),title('3*3模板');
subplot(1,3,3),imshow(Z2),title('5*5模板');
%均值滤波
H2=fspecial('average',3);
JZ=filter2(H2,I)/255;
H1=fspecial('average',5);
JZ1=filter2(H1,I)/255;
figure,
subplot(1,3,1),imshow(I),title ('原图');
subplot(1,3,2),imshow(JZ),title ('3*3模板')
subplot(1,3,3),imshow(JZ1),title ('5*5模板')
%维纳滤波
W1=wiener2(I,[3,3]);
W2=wiener2(I,[5,5]);
figure,
subplot(1,3,1),imshow(I),title ('原图');
subplot(1,3,2),imshow(JZ),title ('3*3模板')
subplot(1,3,3),imshow(JZ1),title ('5*5模板')

猜你喜欢

转载自blog.csdn.net/LiuJiuXiaoShiTou/article/details/78588834