用matlab给图像加高斯噪声和椒盐噪声(不调用imnoise函数)

Posted Julye

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用matlab给图像加高斯噪声和椒盐噪声(不调用imnoise函数)相关的知识,希望对你有一定的参考价值。

图像画面中的噪声,大致可以分为两类:高斯噪声和椒盐噪声。在这里,我们先看下图像中两种噪声各自的特征。

椒盐噪声:噪声幅值基本相同,但出现位置随机。

高斯噪声:图像中每一点都存在噪声,但幅值是随机分布的。

用matlab给一个图像加高斯噪声:

image=imread(‘E:\image\pepper.jpg‘);
[width,height,z]=size(image);
if(z>1)
    image=rgb2gray(image);
end
figure(2);
subplot(1,2,1);
imshow(image);
title(‘原图‘);
av=0;
std=0.1;
u1=rand(width,height);
u2=rand(width,height);
x=std*sqrt(-2*log(u1)).*cos(2*pi*u2)+av;
result1=double(image)/255+x;
result1=uint8(255*result1);

subplot(1,2,2);
imshow(result1);
title(‘加高斯噪声后‘);

加入椒盐噪声:

image=imread(‘E:\image\pepper.jpg‘);
[width,height,z]=size(image);
if(z>1)
    image=rgb2gray(image);
end
result2=image;
figure(2);
subplot(1,2,1);
imshow(image);
title(‘原图‘);
k1=0.1;
k2=0.3;
a1=rand(width,height)<k1;
a2=rand(width,height)<k2;
result2(a1&a2)=0;
result2(a1& ~a2)=255;
subplot(1,2,2);
imshow(result2);
title(‘加高斯噪声后‘);

 

以上是关于用matlab给图像加高斯噪声和椒盐噪声(不调用imnoise函数)的主要内容,如果未能解决你的问题,请参考以下文章

现有一含有椒盐噪声的图像image.jpg如何增强该图像,写出matlab程序

matlab图片添加噪音

Matlab编程,选用模糊小波变换法对含有高斯噪声和椒盐噪声的图像进行去噪。

怎样用matlab实现加入高斯噪声、椒盐噪声、脉冲噪声和乘性噪声,然后采取合适的滤波器进行去噪处理~~~~

Python-给图像添加椒盐噪声和高斯噪声

图像处理:随机添加椒盐噪声和高斯噪声Python