I=imread('**.bmp');I=rgb2gray(I);J=imnoise(I,'salt&pepper',0.02);subplot(231),imshow(I);title('原图像');subplot(232),imshow(J);title('添加椒盐噪声图像');k3=medfilt2(J,[7,7]); %进行7*7模板中值滤波subplot(235),imshow(k3);title('7*7模板中值滤波');