how to calculate actual snr of image in matlab?
Show older comments
how to calculate actual snr of image in matlab?
Accepted Answer
More Answers (1)
Dhurgham Al-karawi
on 29 Aug 2017
Edited: Image Analyst
on 29 Aug 2017
Hi,
Here you are.
img=imread('.JPG');
img=double(img(:));
ima=max(img(:));
imi=min(img(:));
ims=std(img(:));
snr=10*log((ima-imi)./ims);
4 Comments
Image Analyst
on 29 Aug 2017
What's the basis for saying this? Unless your image is supposed to be completely uniform, the standard deviation is not noise. It is just variation in your scene that is supposed to be there. And the range of the image is not the signal. To compute the noise you need to know the reference, perfect, non-noisy image.
Katy Vecchiato
on 17 Oct 2019
Hello,
so how do you calculate the SNR for a SINGLE image without a reference?
Thank you
Image Analyst
on 17 Oct 2019
A signal to noise ratio requires both a signal, and noise. If you don't have each of those, you can't do it. However there are single image quality metrics. Try this link.
Alan Keenan
on 20 Sep 2021
Perform a histogram on your image and then decide at what level you consider to be signal, i.e., above a value is signal and below that value is noise. If your image is in dB then you might use -6dB as the threshold value. In my case my max signal value is always 0dB as it has been normalised to the max value and converted to dB. So you can say anything less than -6dB is noise and anything greater than -6dB is signal. An easy way to calculate the noise floor is rms(rms(image));. This means that if your signal has a max value of 0dB then the peak SNR for your signal = 0dB + the value of the rms calculation.
Categories
Find more on Read, Write, and Modify Image in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!