I have been working on image processing. I have an image and then add it a Gaussian noise with standard deviation=0.005. then using averaging filter to denoise it (I know it is not a good idea). then I got negative PSNR. what this means? I think PSNR is a positive measurement. the code for calculating PSNR is as follow:

function psnr1=PSNR(I,J)



what is wrong? the final results for my code is these curves: avg means averaging filter is applied and W is window size

  • $\begingroup$ If the MSE is very small, then you should most certainly get negative dB values for PSNR. It just means that the smoothing of the small-variance noise does much better than smoothing the noise with the higher variance. $\endgroup$
    – Peter K.
    Commented Apr 14, 2015 at 0:01
  • $\begingroup$ @PeterK. but 'I' is my original image and 'J' is noise-reduced form noisy image with noise power=0.005 using an averaging filter. Why it is not negative for avg var=0.05 with the same window size? $\endgroup$
    – David
    Commented Apr 14, 2015 at 0:29
  • 1
    $\begingroup$ Remember that dB is the logarithm of a value. A negative log simply means that the original value was less than 1.0. For instance log10(0.0001) = -4. $\endgroup$
    – Simon B
    Commented Apr 14, 2015 at 12:11
  • 1
    $\begingroup$ Isn't that 255? Or are you using 16 bit pixels? 255^2 is the square of the largest pixel value...? $\endgroup$
    – Peter K.
    Commented Apr 15, 2015 at 15:12
  • 1
    $\begingroup$ @peterk, yes exactly. $\endgroup$
    – David
    Commented Apr 15, 2015 at 15:14

1 Answer 1


By definition of the [Peak Signal to Noise Ratio][1] (PSNR) its value is:

$$ PSNR = 10 \log_{10} \left( \frac{{max}^{2} \left( I \right)}{MSE} \right) $$

If the MSE is larger than ${max}^{2} \left( I \right)$ (set to $255^2$) in the code above, then the fraction will be smaller than one and the logarithm will result in a negative value.

The code assumes the input image used 8-bit integer values for its pixels (max value is 255), but the images you compare have differences that are larger than that. Either the noise added to one is very large, or you are dealing with 12-bit or 16-bit images.

In general, the PSNR is negative when the noise is larger than the peak signal.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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