4
$\begingroup$

I want to add white gaussian noise to an image of 10 dB in Matlab.

I tried to use Matlab function imnoise but I couldn't figure out what values for mean and variance should I choose to add noise of 10 dB.

How do I do this ?

$\endgroup$
  • $\begingroup$ Did my answer help you? If so, consider upvoting and/or accepting it. $\endgroup$ – A. Donda Jun 2 '15 at 19:08
9
$\begingroup$

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:

enter image description here

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.

$\endgroup$
2
$\begingroup$

use y=wgn(m,n,p) command in matlab. it generates a mxn matrix of white Gaussian noise. p specifies the power of y in decibels relative to a watt.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.