How to add white gaussian noise to an image in Matlab?
Additive noise is usually mean-free, i.e. the mean should be 0. A noise level of 10 dB = 1 B ("bel") usually means that the variance of the noise is by a factor 10¹ = 10 smaller than the variance of the image. As the documentation states, the variance parameter to imshow is interpreted under the assumption that the image data are doubles in the range [0, 1].

Here's an example:

Load sample grayscale image included with Matlab:

[I, map] = imread('eight.tif');


That image is of data type uint8, i.e. integers in the range 0 to 255. Let's convert it to a double in [0, 1]:

I = double(I) / 255;


Compute the image variance

v = var(I(:));


and tell imnoise to add Gaussian white noise with mean 0 and a tenth of that variance:

J = imnoise(I, 'gaussian', 0, v / 10);


This is the result:



Because imnoise clips the data to the range [0, 1] after adding noise, the actual noise variance is smaller,

var(J(:) - I(:)) / v


gives something like 0.093.