I am working with an image X, I apply the "adaptive median filter" in it and I get the image Y. I'd like to measure the SNR in both in order to evaluate the quantity of noise deleted.

I know the formula to calculate the SNR is:

SNR = Psignal / Pnoise

but I don't know how to get these values from both images I have. I was thinking in substract the image X from Y and get the noise value. But I am not sure about the method.

  • 2
    $\begingroup$ Unless you have access to the 'ground' truth where you can actually separate the signal and the noise, and calculate statistics on that, this is an ill posed problem and there is no general solution to that, but only domain specific approaches. This is an 'active' (or at least open) field of research. There are a few data driven methods to determine SNR on a single image, that exploit some assumptions on the spectral properties of the signal and the noise, and these are normally relatively broad and reasonable assumption. You may want to do a literature research on those. $\endgroup$ – norok2 Apr 6 '17 at 9:31

You want to measure the signal to noise ratio on each image. This is akin to asking what the error is of a single number: you don't know. What's the error of five? That doesn't make any sense.

In this case it might be more interesting to find out the the SNR of the process. Here's how you might go about that:

Start with a "perfect" image. That is, an image who's noise is so low that it could be considered negligible. Use some very high quality, standard or constructed image for this purpose, like lenna. That's your signal.

Add some noise. Usually we use gaussian white noise for this purpose. That's your noise.

Now, the combined image (your "noisy image") has a signal to noise ratio with some meaning because you can compare it to the perfect image, eg pixel by pixel.

After processing it with your adaptive median filter, your final image (your "processed image") also has a signal to noise ratio because, again, you can compare it to your perfect image in the same way. It is now meaningful to ask if the SNR has gone up or down and by how much.

| cite | improve this answer | |
  • $\begingroup$ Well, my main goal is to measure the amount of noise in both image X and image Y, if the SNR increase I will know if the filter removed the noise. Is my approach incorrect? In the real world you don't add noise to the images, the images are noisy and you must to apply filters to remove the noise. I am looking for a good technique to know if I removed noise. Is not SNR for that purpose? $\endgroup$ – omar Mar 13 '13 at 1:18
  • 2
    $\begingroup$ In "the real world" you don't know how much noise is in the image (or any data), which is why you create artificially noisy images. This is a standard technique in image processing research. $\endgroup$ – Bjorn Roche Mar 13 '13 at 14:59
  • $\begingroup$ Thank you Bjorn Roche; But how we calculate the SNR Knowing that there are several way to calculate it I'm confused which one can I use? 'in this case for exemple' $\endgroup$ – Ahmed Jul 11 '13 at 10:22
  • $\begingroup$ @Ahmed: That's a topic for a different question. $\endgroup$ – Bjorn Roche Jul 11 '13 at 19:06
  1. Calculate the $P_{signal}$ as the mean of pixel values.
  2. Calculate the $P_{noise}$ and the standard deviation or error value of the pixel values.
  3. Take the ratio or you may use $SNR=10\log_{10}(P_{signal}/P_{noise})$ to express the result in decibel.
| cite | improve this answer | |
  • $\begingroup$ I added math markup to your answer. Hope this made it clearer... $\endgroup$ – Russ Lenth Sep 5 '14 at 15:30
  • 1
    $\begingroup$ Why would the standard deviation be a measure of noise? This only works if the image is uniform. $\endgroup$ – anderstood Feb 27 '16 at 17:08
  • $\begingroup$ Where do you use the standard deviation of the noise in your calculation? I see you only use the powers (means) in the formula. $\endgroup$ – MattS Nov 6 '19 at 16:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.