matlab图像加椒盐噪声,用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)

a2=rand(width,height)

result2(a1&a2)=0;

result2(a1& ~a2)=255;

subplot(1,2,2);

imshow(result2);

title(‘加高斯噪声后‘);

原文:http://www.cnblogs.com/pxrsun/p/7620420.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值