# Is it possible to have negative PSNR?

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)

mse1=(double(I)-double(J)).^2;
MSE1m=(mse1(:,:,1,:)+mse1(:,:,2,:)+mse1(:,:,3,:))/3;
psnr1=10*log10(255^2/mean(mean(MSE1m)));

end


what is wrong? the final results for my code is these curves:

• 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.
– Peter K.
Commented Apr 14, 2015 at 0:01
• @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? Commented Apr 14, 2015 at 0:29
• 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. Commented Apr 14, 2015 at 12:11
• Isn't that 255? Or are you using 16 bit pixels? 255^2 is the square of the largest pixel value...?
– Peter K.
Commented Apr 15, 2015 at 15:12
• @peterk, yes exactly. Commented Apr 15, 2015 at 15:14

$$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.