给图像加入噪声的函数imnoise,主要涉及高斯噪声和椒盐噪声。
高斯噪声函数:
g=imread('QQ图片20230513144043.jpg');
h=imnoise(g,'gaussian',0.05,0.1);
subplot(1,2,1),imshow(h);
title('高斯噪声转换图');
subplot(1,2,2),imshow(g);
title('原图');
椒盐噪音函数:
g=imread('QQ图片20230513144043.jpg');
h=imnoise(g,'salt & pepper',0.05);
subplot(1,2,1),imshow(g);
title('原图')
subplot(1,2,2),imshow(h);
title('椒盐噪声转换图')