imnoise

采用函数imnoise来使用噪声污染一幅图像,该函数的基本语法为:
g=imnoise(f,type,parameters)
f为是输入图像。函数imnoise在给图像添加噪声之前,将它转换为范围[0,1]内的double类图像。指定噪声参数时必须考虑到这一点。
g=imnoise(f,' gaussian',m,var)将 均值M, 方差为var的 高斯噪声加到图像f上, 默认值为均值是0,方差是0.01的噪声。
g=imnoise(f,'localvar',V)将均值为0,局部方差为V的 高斯噪声添加到图像f上,其中V是与f大小相同的一个数组,它包含了每一个点的理想方差值。
g=imnoise(f,'localvar',image_intensity,var)将 均值为0的 高斯噪声添加到图像f中,其中噪声的局部 方差var是图像f的亮度值的 函数。参量image_intensity和var是大小相同的向量,plot(image_intensity,var)绘制出噪声 方差和图像亮度的 函数关系。向量image_intensity必须包含范围在[0,1]内的 归一化亮度值。
g=imnoise(f,'salt&pepper',d)用椒盐噪声污染图像f,其中d是噪声密度(即包括噪声值的图像区域的百分比)。因此,大约有d*numel(f)个像素受到影响。默认的噪声密度为0.05。
g=imnoise(f,'speckle',var)用方程g=f+n*f)将乘性噪声添加到图像f上,其中n是均值为0,方差为var的均匀分布的随机噪声,var的 默认值是0.04。
g=imnoise(f,'poisson')从数据中生成泊松噪声,而不是将人工的噪声添加到数据中,为了遵守泊松统计,unit8和unit16类图像的亮度必须和光子的数量相符合。当每个像素的光子数量大于65535时,就要使用双精度图像。亮度值在0到1之间变化,并且对应于 光子的数量除以10e12。
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值