title: Gaussian noise,MATLAB
body: <p>The objective is to add additive gaussian noise of zero mean and variance of 400 to an image.</p>
  
  <p>For example, if i wanted to add additive gaussian noise of zero mean and variance 0.5, i can use one of the two following methods:</p>
  
  <p>1) The imnoise command in Matlab:</p>
  
  <pre><code>                 Noisyimg=imnoise(I,'gaussian',0,0.5) 
  </code></pre>
  
  <p>where I is the image to 
        which the noise is being added and Noisyimg is the noisy image.</p>
  
  <p>2) Create a matrix of random numbers taken from the normal distribution 
        with the mean and standard deviation specified, by using the randn 
        command.</p>
  
  <pre><code>       noisemat= a*randn(size(I))+ b;  where a=standard deviation and b=mean
         Noisyimg=noisemat+I;                   
  </code></pre>
  
  <p>Thus,for zero mean and a variance of 0.5,</p>
  
  <pre><code>      noisemat=sqrt(0.5)*randn(size(I))+0; 
  </code></pre>
  
  <p>since standard deviation
        is square root of variance.</p>
  
  <p>But, when i try to apply the above two methods to obtain a noisy image with a additive gaussian noise of zero mean and a variance of 400, am ending up with indiscernible images. For eg, using method two,</p>
  
  <pre><code>      noisemat=sqrt(400)*randn(size(I))+0; 
        Noisyimg=noisemat+I;
  </code></pre>
  
  <p>The resultant noisy image is nowhere near the actual noisy image that i should be obtaining.This, am aware, because i have the picture of the actual noisy output that i should be obtaining. Am i making any mistake in implementing the commands or am i missing some critical points.
  I have attached the original image to which i was trying to add the gaussian noise and the image that was obtained after the addition of noise.<br>
  <a href="http://i.stack.imgur.com/epvyE.jpg" rel="nofollow">original image(I)</a>
   <a href="http://i.stack.imgur.com/PntR1.jpg" rel="nofollow">Noisyimg</a></p>
  
  <p>Any help would be greatly appreciated!! </p>