function 各种噪声及滤波效果显示,与噪声密度及滤波模版大小均有关系

clear;
%function 各种噪声及滤波效果显示,与噪声密度及滤波模版大小均有关系%
I  = imread('eight.tif');
J  = imnoise(I ,'salt & pepper',0.02);
K = imnoise(I ,'gaussian',0,0.001);

subplot(331),imshow(I),title('orignal');
subplot(332),imshow(J),title('椒盐噪声');
subplot(333),imshow(K),title('0均值高斯噪声');
h =  fspecial('average',3);
L  = filter2(h,J)/255;
M  = filter2(h,K)/255;
subplot(334),imshow(L),title('均值滤波椒盐');
subplot(335),imshow(M),title('均值滤波高斯');

N =  medfilt2(J,[3 3]);
O =  medfilt2(K,[3 3]);
subplot(336),imshow(N),title('中值椒盐');
subplot(337),imshow(O),title('中值高斯');

P = wiener2(J ,[3 3]);
Q = wiener2(K ,[3 3]);
subplot(338),imshow(P),title('wiener椒盐');
subplot(339),imshow(Q),title('wiener高斯');

你可能感兴趣的:(function,filter,matlab)