How do I calculate SNR from a single area of an image?
155 views (last 30 days)
Show older comments
I'm trying to find the SNR (signal-to-noise ratio) of a single area of an image, a neutral gray to be specific. I've already found how to select a ROI for the image to do the calculation, but need assistance in the calculation of SNR. My calculation is currently set up to follow the very simple derivation of SNR which is the mean of the signal divided by the standard deviation of the signal. The results I obtain give me very small SNR values, and I've even done dark noise subtraction and my SNR ended up being lower, which is the opposite of the desired result.
I've used Matlab's built-in functions for the mean and standard deviation:
meanval = mean2 (I_roi);
stdval = std2 (I_roi);
snr = (meanval / stdval);
My image is a 16-bit grayscale image, so I do not have the different color channels of RGB and therefore have a 2-D matrix to represent the image. I'm currently under the impression that this calculation is too simple to be true and am wondering if there is a may more precise and accurate method of calculating SNR.
0 Comments
Answers (1)
Sruthi Geetha
on 23 Oct 2017
There are several options (and definitions) for the calculation of the SNR of or in an image.
First, there are two incompatible definitions of the SNR: SNR is frequently (e. g., in many engineering applications) defined as the ratio of the signal power and the noise power (which is consistent with the definition by Gonzalez given above), but – particularly in imaging – an alternative definition can be found, where SNR is given as the ratio of the mean value of the signal and the standard deviation of the noise.
The power ratio (first definition above) is frequently expressed in dB (using the logarithm), while the signal ratio (second definition) is more often given as a number (of dimension 1).
Second, you must define in which part of the image the signal (power or mean value) is determined. Typical choices are: (1) the maximum power or intensity within the image; this gives you the peak-signal-to-noise ratio (PSNR); (2) the mean power or intensity; or (3) the power or signal of a reference structure within the image (e. g., in medical images with large amounts of (zero signal) background this is more useful than including the background into the mean power or signal).
If you already know the noise standard deviation (and the statistical distribution of noise and its spatial distribution – noise may be distributed non-uniformly over the image), then you are done and you can calculate the SNR of your choice. (If you do not know the noise level (standard deviation or variance), it can be difficult to measure it reliably in an image – at least, if you do not have a noise-free image.)
You can't simply say the signal to noise ratio is the ratio of the mean of the image to the standard deviation of the image. [peaksnr,snr] = psnr(___) returns the simple signal-to-noise ratio, snr, in addition to the peak signal-to-noise ratio. You can refer the documentation of psnr for more information on using the command.
1 Comment
Tarun Uday
on 28 Aug 2018
As someone with a Mathworks STAFF flair, please read the answer you are posting. You've copied and pasted an answer from ResearchGate verbatim without any attribution and the extra couple of sentences you've written yourself have no context to the question being asked.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!