图像处理之matlab中imnoise函数用法详解

一、图像噪声基本概念

噪声在图像上常表现为引起较强视觉效果的孤立像素点或像素块。一般噪声信号与要研究的对象不相关,其以无用的信息形式出现,扰乱图像的可观测信息。通俗的说即噪声让图像不清楚。

二、常见噪声的分类

1、高斯噪声

高斯噪声是指其概率密度函数服从高斯分布(即正态分布)的一类噪声。若一个噪声,其幅度分布服从高斯分布,且其功率谱密度又是均匀分布,则称为高斯白噪声。高斯白噪声的二阶矩不相关,一阶矩为常数,是指先后信号在时间上的相关性。高斯噪声的噪声信号随机分布,没有规律

2、泊松噪声

泊松噪声是指其概率密度函数服从泊松分布的一类噪声,泊松分布适合于描述单位时间内随机事件发生的次数的概率分布。泊松噪声一般在亮度很小或者高倍电子放大线路中出现。

3、椒盐噪声

椒盐噪声又称脉冲噪声,其随机改变一些像素值,在二值图像上表现为使一些像素点变白,一些像素点变黑。椒盐噪声是由图像传感器,传输信道,解码处理等产生的黑白相间的亮暗点噪声,往往由图像分割引起,老式电视机常常出现的“雪花”即为椒盐噪声。

4、斑点/乘性噪声

根据相干原理进行成像的系统中普遍存在的一类噪声,如超声、雷达、SAR等。噪声原理是反射表面在波长尺度上是粗糙的,因此反射波存在明显的散射效应,导致所成的像出现斑点。

三、imnoise()函数基本调用格式

语法参数说明
J = imnoise(I,type)按照给定类型添加图像噪声给图像I
J = imnoise(I,type,parameters)按照给定类型添加图像噪声给图像I,parameters泛指可以添加的参数,类型不同,参数不同
J = imnoise(I,‘gaussian’,m,v)添加高斯白噪声给图像I,均值为m,方差为v。默认m = 0,v = 0.01
J = imnoise(I,‘localvar’,V)将均值为0,局部方差为V的高斯噪声添加到图像I上,其中V是与I大小相同的一个数组
J = imnoise(I,‘localvar’,h,v)在图像的不同亮度值上叠加不同方差的高斯噪声,h为在[0,1]之间的向量,表示图像的亮度值,v为一个长度和h相同,表示与h中亮度对应的高斯噪声的方差
J = imnoise(I,‘poisson’)添加泊松噪声给图像I
J = imnoise(I,‘salt & pepper’,d)添加椒盐噪声给图像I,噪声密度为d。默认d=0.05
J = imnoise(I,‘speckle’,v)添加斑点/乘性噪声给图像I,方差为v。默认v=0.04

四、imnoise()函数应用实例

I = imread('pout.tif');
figure(1),imshow(I);
title('Original image');
figure(2),
J = imnoise(I,'gaussian',0,0.03);   % 添加高斯白噪声,均值0,方差0.03
subplot(221),imshow(J);
title('Gaussian');
K = imnoise(I,'salt & pepper',0.03);% 添加椒盐噪声,噪声密度0.03
subplot(222),imshow(K);
title('Salt & Pepper');
L = imnoise(I,'poisson');           % 添加泊松噪声
subplot(223),imshow(L);
title('Poisson');
M = imnoise(I,'speckle',0.03);      % 添加斑点/乘性噪声,方差为0.03
subplot(224),imshow(M);
title('Speckle');

输出效果:
在这里插入图片描述

在这里插入图片描述
注意:原始图像是uint8的灰度图像,灰度值范围为[0,255],故imnoise函数在处理时会将图像先转换为[0,1],然后按照所给的均值和方差添加噪声,最后再将图像转换到[0,255]的范围内。因此参数设置需注意,若所给的图像是uint8时,所给的均值和方差必须是在[0,1]的范围内,即归一化,否则直接给100的方差时,imnoise函数会将图像归一化,然后按照方差100来添加噪声,这样原先的图像就给淹没了,反而变成了噪声为主导的图像。

补充:图像噪声的特点

  • 噪声在图像中的分布和大小不规则,即具有随机性。
  • 噪声与图像之间一般具有相关性。
  • 噪声具有叠加性。
  • 18
    点赞
  • 163
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
function R = imnoise2(type, varargin) %IMNOISE2 Generates an array of random numbers with specified PDF. % R = IMNOISE2(TYPE, M, N, A, B) generates an array, R, of size % M-by-N, whose elements are random numbers of the specified TYPE % with parameters A and B. If only TYPE is included in the % input argument list, a single random number of the specified % TYPE and default parameters shown below is generated. If only % TYPE, M, and N are provided, the default parameters shown below % are used. If M = N = 1, IMNOISE2 generates a single random % number of the specified TYPE and parameters A and B. % % Valid values for TYPE and parameters A and B are: % % 'uniform' Uniform random numbers in the interval (A, B). % The default values are (0, 1). % 'gaussian' Gaussian random numbers with mean A and standard % deviation B. The default values are A = 0, B = 1. % 'salt & pepper' Salt and pepper numbers of amplitude 0 with % probability Pa = A, and amplitude 1 with % probability Pb = B. The default values are Pa = % Pb = A = B = 0.05. Note that the noise has % values 0 (with probability Pa = A) and 1 (with % probability Pb = B), so scaling is necessary if % values other than 0 and 1 are required. The noise % matrix R is assigned three values. If R(x, y) = % 0, the noise at (x, y) is pepper (black). If % R(x, y) = 1, the noise at (x, y) is salt % (white). If R(x, y) = 0.5, there is no noise % assigned to coordinates (x, y). % 'lognormal' Lognormal numbers with offset A and shape % parameter B. The defaults are A = 1 and B = % 0.25. % 'rayleigh' Rayleigh noise with parameters A and B. The % default values are A = 0 and B = 1. % 'exponent

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值