Which one is the correct way of simulating addtive Gaussian noise
<p>I have a noise-free image <code>I</code>. I want to simulate the additive Gaussian noise (zero mean, and variation <code>v</code>) <code>n</code> added to the image. The output of the <a href="https://en.wikipedia.org/wiki/Additive_white_Gaussian_noise" rel="nofollow noreferrer">model</a> is:</p>

<pre><code>Z = I + n
</code></pre>

<p>To simulate it, we have two ways:</p>

<ol>
<li>create a gaussian noise and add it to image,</li>
<li>use <code>imnoise</code> function in MATLAB.</li>
</ol>

<p>I used both ways, but they gave different results. Could you determine which one is correct? Why aren't they equivalent? In my knowledge, I think <code>imnoise</code> is correct one.</p>

<p>In my simulation, I use a definition of noise percent as</p>

<blockquote>
  <p>The "percent noise" number represents the percent ratio of the standard deviation of the Gaussian noise versus the signal for whole image.</p>
</blockquote>

<pre><code>I = imread('eight.tif');
[rows cols]=size(I);
I = double(I);
I = I - min(I(:));
I = I / max(I(:));
%% Percentage ratio
noise_per=0.4; %40 percent noise
%% Add noise to image
v = (noise_per*std(I(:)))^2 %// Option #2
%% Add noise by manual way
n=normrnd(0,v,[rows cols]);
I_noise1=I+n;
%% Add noise by imnoise func.
I_noise2 = imnoise(I, 'gaussian', 0, v);

subplot(131);imshow(n,[]);title('Gaussian noise');
subplot(132);imshow(I_noise1,[]);title('Add Gaussian noise #1');
subplot(133);imshow(I_noise2,[]);title('Add Gaussian noise #2');
</code></pre>

<p><a href="https://i.stack.imgur.com/4XjWJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4XjWJ.png" alt="output"></a></p>