问题
I have this image:
![](https://www.eimg.top/images/2020/03/19/de13b801bcf0a9110f5611d15197cb1a.jpg)
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:
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.
来源:https://stackoverflow.com/questions/25699903/calculate-snr-in-single-image-in-matlab