2);imshow(K1);title('领域为3*3二维中值滤波')Рsubplot(2,2,3);imshow(K2);title('领域为5*5二维中值滤波') Рsubplot(2,2,4);imshow(K3);title('领域为7*7二维中值滤波') Р2、采用MATLAB中的函数filter2对受噪声干扰的图像进行均值滤波РI = imread('f:\lena.png');Рj=imnoise(i,'gaussian',0,0.02);%模拟均值为0方差为0.02的高斯噪声,РM= filter2(fspecial('average',9),J)/255; %模板尺寸为9Рsubplot(2,1,1);imshow(j);title('噪声干扰图像')Рsubplot(2,1,2);imshow(M);title('改进后的图像')Р采用三种不同算子对图像进行锐化处理。Рi=imread('f:\1.jpg')РI=rgb2gray(s)РH=fspecial('sobel')%应用Sobel算子锐化图像РI1=filter2(H,I)%Sobel算子滤波锐化РH=fspecial('prewitt')%应用prewitt算子锐化图像РI2=filter2(H,I)%prewitt算子滤波锐化РH=fspecial('log')%应用log算子锐化图像РI3=filter2(H,I)%log算子滤波锐化Рsubplot(2,2,1);imshow(i);title('原图像')Рsubplot(2,2,2);imshow(I1);title('Sobel算子锐化图像')Рsubplot(2,2,3);imshow(I2);title('prewitt算子锐化图像') Рsubplot(2,2,4);imshow(I3);title('log算子锐化图像')