Hello all, I am trying to add noise of 5dB to an image in matlab according to the following steps SNR = 5; Id = double(Io) / 255; v = var(Id(:)) / 10^(SNR/10); I_my_noisy = imnoise(Id, 'gaussian', 0, v); but when I measure the SNR by using the matlab command [peaksnr,snr] = psnr(I_my_noisy, Id) I get SNR equal 10. So, what is the wrong in my code? and why the result differ from my add dB? --------------------------------------- Posted through http://www.DSPRelated.com
Measuring the correct SNR for image in matlab
Started by ●February 16, 2016
Reply by ●February 26, 20162016-02-26
On 2016-02-16 7:55, bamerni wrote:> Hello all, > > I am trying to add noise of 5dB to an image in matlab according to the > following steps > > SNR = 5; > Id = double(Io) / 255; > v = var(Id(:)) / 10^(SNR/10); > I_my_noisy = imnoise(Id, 'gaussian', 0, v); > > > but when I measure the SNR by using the matlab command > > [peaksnr,snr] = psnr(I_my_noisy, Id) > > I get SNR equal 10. So, what is the wrong in my code? and why the result > differ from my add dB?What do you get if you use SNR3 = 10*log10(var(Id)/var(I_my_noisy-Id)) ? What does psnr return for a simple ideal image with one single pixel "1" (all other 0) and with the noisy image containing 2.7783 ?