%均值滤波%方法一:filter2clear all;figureI=rgb2gray(imread(132.jpg);I=imnoise(I,salt & pepper,0.1); %加入椒盐噪声K1=filter2(fspecial(average,3),I)/255; %进行3*3均值滤波K2=filter2(fspecial(average,5),I)/255; %进行5*5均值滤波K3=filter2(fspecial(average,7),I)/255; %进行7*7均值滤波subplot(2,2,1),imshow(I),title(椒盐噪声图); %显示原图像subplot(2,2,2),imshow(K1),title(3*3均值滤波图像); subplot(2,2,3),imshow(K2),title(5*5均值滤波图像);subplot(2,2,4),imshow(K3),title(7*7均值滤波图像);%方法二 双循环语句,移