## Sunday, November 17, 2013

### Difference between SNR and PSNR

In Image processing, we often use Signal to Noise Ratio (SNR) and Peak Signal to Noise Ratio (PSNR) for quality measurement.

 I understood that SNR is the ratio of signal power to the noise power. In terms of images, it shows how the original image is affected by the added noise. In PSNR, we take the square of the peak value in the image (in case of an 8 bit image, the peak value is 255) and divide it by the mean square error. The SNR and PSNR are used to measure the quality of an image after the reconstruction. I understand that higher the SNR or PSNR, the reconstruction is good. What I don't understand is how SNR and PSNR differs in terms of their conclusion about the reconstructed image. What the PSNR of an image concludes that the SNR of the same image can't conclude ? Simply how the conclusion of PSNR differs from the conclusion of SNR?  These are the questions I had when tried to completely understand what is this SNR and PSNR. If you too have the same questions, read further to get clarified.
Discrete signal power is defined as
Ps=s2[n]=|s[n]|2.
We can apply this notion to noise w on top of some signal to calculate Pw in the same way. The signal to noise ratio (SNR) is then simply
PSNR=PsPw
If we've received a noise corrupted signal x[n]=s[n]+w[n] then we compute the SNR as follows

PSNR=PsPw=Ps|x[n]s[n]|2.
Here |x[n]s[n]|2 is simply the squared error between original and corrupted signals. Note that if we scaled the definition of power by the number of points in the signal, this would have been the mean squared error (MSE) but since we're dealing with ratios of powers, the result stays the same.
Let us now interpret this result. This is the ratio of the power of signal to the power of noise. Power is in some sense the squared norm of your signal. It shows how much squared deviation you have from zero on average.
You should also note that we can extend this notion to images by simply summing twice of rows and columns of your image vector, or simply stretching your entire image into a single vector of pixels and apply the one-dimensional definition. You can see that no spacial information is encoded into the definition of power.
Now let's look at peak signal to noise ratio. This definition is

PPSNR=max(s2[n])MSE.

If you stare at this for long enough you will realize that this definition is really the same as that of PSNR except that the numerator of the ratio is now the maximum squared intensity of the signal, not the average one. This makes this criterion less strict. You can see that PPSNRPSNR and that they will only be equal to each pother if your original clean signal is constant everywhere.

Now, why does this definition make sense? It makes sense because the case of SNR we're looking at how strong the signal is to how strong the noise is. We assume that there are no special circumstances. In fact, this definition is adapted directly from the physical definition of electrical power. In case of PSNR, we're interested in signal peak because we can be interested in things like the bandwidth of the signal, or number of bits we need to represent it. This is much more content-specific than pure SNR and can find many reasonable applications, image compression being on of them. Here we're saying that what matters is how well high-intensity regions of the image come through the noise, and we're paying much less attention how we're performing under low intensity.