How to calculate the signal-to-noise ratio (SNR) in an image? 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.
 A: 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.
A: *

*Calculate the $P_{signal}$ as the mean of pixel values.

*Calculate the $P_{noise}$ and the standard deviation or error value of the pixel values.

*Take the ratio or you may use $SNR=10\log_{10}(P_{signal}/P_{noise})$ to express the result in decibel.

