人为的在灰度图像中加入均值为0,方差为0.02的高斯噪声,通过100次相加求平均的方法去除所加入的噪声,比较显示原图、加噪图与去噪图。
x=rgb2gray(imread('peppers.png'));
subplot(1,3,1);
imshow(x);
title('原图');
j= imnoise(x,'gaussian',0,0.02);
subplot(1,3,2);
imshow(j);
title('加噪后');
H1=zeros(size(x));
for i=1:100
j=imnoise(x,'gaussian',0,0.02);
H1=H1+double(j);
end
H=H1/100;
subplot(1,3,3);
imshow(uint8(H));
title('去噪后');