图像平滑处理对比

来源:互联网 发布:淘宝现金流量表 编辑:程序博客网 时间:2024/05/16 15:19
%加入椒盐噪声M = imread('photo.jpeg');I = rgb2gray(M);J = imnoise(I,'salt & pepper');w = [1,2,1;2,4,2;1,2,1]/16;J1 = imfilter(J,w,'corr','replicate');w = [1,1,1;1,1,1;1,1,1]/9;J2 = imfilter(J,w,'corr','replicate');J3 = medfilt2(J,[3,3]);figure;subplot(2,3,1);imshow(I),title('原图像');subplot(2,3,2);imshow(J),title('椒盐噪声');  subplot(2,3,4);imshow(J1),title('高斯平滑');subplot(2,3,5);imshow(J2),title('平均平滑');subplot(2,3,6);imshow(J3),title('中值平滑');