4
votes

When adding additive white Gaussian noise in MATLAB, one can use the predefined function

J = imnoise(I,'gaussian',M,V) % I is the image to add the noise

with default, zero mean (M) and variance (V) 0.01. The manual for this function is here.

However, in various MATLAB codes, I've also seen that additive Gaussian noise is added to the image by the following way

sigma = 10; % standard deviation (STD)

g = I + sigma * randn(size(I)); %add gaussian noise with STD 10

Which is fine. Now, we know the formula for variance,

[![variance=sigma^2][2]][2]

where sigma is the STD. So, according to the second code, I have sigma = 10 thus, the variance (V) should be 100. Using MATLAB imnoise function for zero mean and variance 100 should be something like this

J = imnoise(I,'gaussian',0,100)

However, this does not produce a corrupted image even close to the second code. The image seems to be 100% corrupted with noise. How is this different ? am I missing something here ?

1

1 Answers

2
votes

The main problem I am seeing is that the imnoise function expects the image to be scaled to the interval [0,1] (see also this answer). Considering this, a variance of 100 makes no sense. You should scale the variance alongside the image and hopefully everything makes sense again.