Question

In MATLAB’s imnoise() function, when the type of noise is 'speckle', the documentation clearly states that it is multiplicative noise and states the underlying equation.

J = 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.

However, no such equation is provided for the gaussian option. And there is a separate type called 'localvar'. So the equation when using imnoise(I, gaussian, mean_noise, variance_noise) should be

J(x,y) = I(x,y) + g(mean_noise, sqrt((variance_noise))

Further, my assumptions:

  1. This noise g is not correlated to the spatial coordinates of the image
  2. This noise g is not correlated to the intensities at those spatial coordinates
  3. g is a gaussian random number generated from a gaussian distribution of mean mean_noise and standard deviation sigma = sqrt(variance_noise)

Am I right?

MAJOR UPDATE
I am unaccepting the previous answer to clear some confusion.So i checked the code for 'imnoise' in matlab and what it does is:

b = a + sqrt(p4)*randn(sizeA) + p3; where
b - image with noise added
a - original image
p4 - variance
p3 - mean

What is the range of randn()? I checked randomly and this produces values higher than 1 like 1.85. And the documentation for randn() fails to mention anything about the range. This is quite strange.

Was it helpful?

Solution

Yes, you are right. The noise is spatially uncorrelated (i.i.d) and also uncorrelated to the signal. Furthermore, the noise is additive and sampled from a zero-mean unit standard deviation Gaussian which is then scaled for user-provided standard deviation and offset by user-provided mean. If no variance and mean values are specified, imnoise chooses zero mean and 0.01 variance.

You can actually see the entire code for by doing >>edit imnoise in MATLAB. You should have the Image Processing Toolbox.

Regarding randn() - it produces i.i.d samples from a zero-mean unit standard deviation Gaussian. The range of a Gaussian is (-Inf Inf) and hence you see values outside the range (-1 1). MATLAB function rand() gives values in the range (-1 1) that are uniformly distributed.

Edited: Updated answer to include exact default mean and variance values.

OTHER TIPS

the function imnoise(I, 'gaussian', mean, variance) need the variance normalized between [0 1]. So if your image is of type 'uint8', you should divide the parameter variance by 255².

Note also that the variance is different of the standard deviation sigma. If you would use sigma, you should put (sigma²/255²) as the variance parameter (because variance = sigma²).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top