分别使用二维统计滤波对椒盐噪声和高斯噪声进行滤波

function FuShiPengZhang
I=imread('C:\Users\user\Desktop\data\Gabor-1-120\2-1.jpg');
J1=imnoise(I,'salt & pepper',0.004); 
subplot(2,3,1);imshow(I); 
title('原始图像'); 
subplot(2,3,2);imshow(J1);
title('加椒盐噪声后的图像'); 
J= ordfilt2(J1,5,ones(3,4));% 进行二维统计顺序过滤 
subplot(2,3,3);imshow(J); title('椒盐噪声滤波后的图像'); 
J2=imnoise(I,'gaussian',0,0.004); 
subplot(2,3,4);imshow(J2); 
title('加高斯噪声后的图像'); 
J3= ordfilt2(J2,5,ones(3,4)); 
subplot(2,3,5);imshow(J3); title('高斯噪声滤波后的图像'); 
end

你可能感兴趣的:(分别使用二维统计滤波对椒盐噪声和高斯噪声进行滤波)