Advertisement

MATLAB图像处理均值滤波

阅读量:

对lena.bmp图像依次实施3×3、5×5、7×7、9×9尺寸的均值滤波操作,并进一步探讨不同模板尺寸对图像质量所产生的影响。

复制代码
    %均值滤波
    I=imread('lena.bmp');
    J=imnoise(I,'salt & pepper',0.02);
    subplot(2,3,1),imshow(I);title('原图')
    subplot(2,3,2),imshow(J);title('添加盐椒噪声')
    k1=filter2(fspecial('average',3),J);
    k2=filter2(fspecial('average',5),J);
    k3=filter2(fspecial('average',7),J);
    k4=filter2(fspecial('average',9),J);
    subplot(2,3,3),imshow(uint8(k1));title('均值滤波3*3模板平滑')
    subplot(2,3,4),imshow(uint8(k2));title('均值滤波5*5模板平滑')
    subplot(2,3,5),imshow(uint8(k3));title('均值滤波7*7模板平滑')
    subplot(2,3,6),imshow(uint8

全部评论 (0)

还没有任何评论哟~