imnoise (adding noise to images)
imnoise is used to add noise in images.
A = imnoise(I,type) A = imnoise(I,type,parameters) A = imnoise(I,'gaussian',M,V) A = imnoise(I,'localvar',V) A = imnoise(I,'localvar',image_intensity,var) A = imnoise(I,'poisson') A = imnoise(I,'salt & pepper',d) A = imnoise(I,'speckle',v) gpuarrayA = imnoise(gpuarrayI,___)
A = imnoise(I,type) adds noise of a given type to the intensity image I. type is a string that specifies any of the following types of noise. Note that certain types of noise support additional parameters. See the related syntax.
|'gaussian'||Gaussian white noise with constant mean and variance|
|'localvar'||Zero-mean Gaussian white noise with an intensity-dependent variance|
|'salt & pepper'||On and off pixels|
|A = imnoise(I,'gaussian',M,V): adds Gaussian white noise of mean m and variance v to the image I. The default is zero mean noise with 0.01 variance.|
|A = imnoise(I,'localvar',V):adds zero-mean, Gaussian white noise of local variance V to the image I. V is an array of the same size as I.|
|A = imnoise(I,'localvar',image_intensity,var): adds zero-mean, Gaussian noise to an image I, where the local variance of the noise, var, is a function of the image intensity values in I. The image_intensity and var arguments are vectors of the same size, and plot(image_intensity,var) plots the functional relationship between noise variance and image intensity. The image_intensity vector must contain normalized intensity values ranging from 0 to 1.|
|A = imnoise(I,'poisson'): generates Poisson noise from the data instead of adding artificial noise to the data. If I is double precision, then input pixel values are interpreted as means of Poisson distributions scaled up by 1e12. For example, if an input pixel has the value 5.5e-12, then the corresponding output pixel will be generated from a Poisson distribution with mean of 5.5 and then scaled back down by 1e12. If I is single precision, the scale factor used is 1e6. If I is uint8 or uint16, then input pixel values are used directly without scaling. For example, if a pixel in a uint8 input has the value 10, then the corresponding output pixel will be generated from a Poisson distribution with mean 10.|
|A = imnoise(I,'salt & pepper',d): adds salt and pepper noise to the image I, where d is the noise density. This affects approximately d*numel(I) pixels. The default for d is 0.05.|
|A = imnoise(I,'speckle',v): adds multiplicative noise to the image I, using the equation J = I+n*I, where n is uniformly distributed random noise with mean 0 and variance v. The default for v is 0.04.|
|gpuarrayA = imnoise(gpuarrayI,___) :adds noise to the gpuArray intensity image gpuarrayI, performing the operation on a GPU. Returns a gpuArray image J of the same class.|
a = imread('Desert.jpg'); b = imnoise(a,'gaussian',0.01); subplot(1,2,1); imshow(a); title('a'); subplot(1,2,2); imshow(b); title('b');