均值滤波对高斯噪声的效果

来源:互联网 发布:仲恺教务网络管理系统 编辑:程序博客网 时间:2024/05/18 02:39
function FuShiPengZhangI=imread('C:\Users\user\Desktop\data\Gabor-5-80-0.5-0.5\2-5.jpg');%读取图像 J=imnoise(I,'gaussian',0,0.005);%加入均值为0,方差为0.005的高斯噪声 subplot(2,3,1);imshow(I);title('原始图像');subplot(2,3,2);imshow(J);title('加入高斯噪声之后的图像'); %采用MATLAB中的函数filter2对受噪声干扰的图像进行均值滤波K1=filter2(fspecial('average',3),J)/255; %模板尺寸为3 K2=filter2(fspecial('average',5),J)/255;% 模板尺寸为5 K3=filter2(fspecial('average',7),J)/255; %模板尺寸为7 K4= filter2(fspecial('average',9),J)/255; %模板尺寸为9 subplot(2,3,3);imshow(K1);title('改进后的图像1');subplot(2,3,4); imshow(K2);title('改进后的图像2'); subplot(2,3,5);imshow(K3);title('改进后的图像3'); subplot(2,3,6);imshow(K4); title('改进后的图像4'); end

原创粉丝点击