Calculate SNR in single image in MATLAB

2020-07-19 03:59发布

I have this image:

noisy image

I want to calculate SNR in it. For this i used code:

img=imread('noicy.JPG');
img=double(img(:));
ima=max(img(:));
imi=min(img(:));
ims=std(img(:));
snr=20*log10((ima-imi)./ims)

Is that correct code to calculate SNR?

1条回答
Evening l夕情丶
2楼-- · 2020-07-19 04:27

The definition of SNR can be found here or here:

Both the standard and the industry definition can be used (10log(x) and 20log(x)). check this

now, the signal is equal to the mean of the pixel values (mean(img(:))) and the noise is the standard deviation or error value of the pixel values (std(img(:))).

You may use either the ratio or the SNR=10*log10(signal/noise) to express the result in decibel.

查看更多
登录 后发表回答