How to Calculate PSNR

••• gorodenkoff/iStock/GettyImages

The peak signal-to-noise ratio (PSNR) is the ratio between a signal's maximum power and the power of the signal's noise. Engineers commonly use the PSNR to measure the quality of reconstructed images that have been compressed. Each picture element (pixel) has a color value that can change when an image is compressed and then uncompressed. Signals can have a wide dynamic range, so PSNR is usually expressed in decibels, which is a logarithmic scale.

    Define the bel and decibel. The bel is defined mathematically as LB = log10 (P1/P0) where P1 and P0 are two quanties that are in the same units of measure. The decibel is 0.1 bel, so the decibel value LdB is LdB = 10 log10 (P1/P0).

    Define the mean squared error (MSE) between two monochromatic images, where one image is considered to be an approximation of the other. The MSE can be described as the mean of the square of the differences in the pixel values between the corresponding pixels of the two images.

    Express MSE mathematically from the description in Step 1. We therefore have MSE = 1/mn [?? (I(i,j) - K(i,j))^2] where I and K are matrices that represent the images being compared. The two summations are performed for the dimensions \"i\" and \"j.\" Therefore I(i,j) represents the value of pixel (i,j) of image I.

    Determine the maximum possible value of the pixels in image I. Typically, this may be given as (2^n) - 1 where n is the number of bits that represent the pixel. Thus, an 8-bit pixel would have a maximum value of (2^8) - 1 = 255. Let the maximum value for pixels in image I be MAX.

    Express the PSNR in decibels. From Step 1, we have the decibel value LdB as LdB = 10 log10 (P1/P0). Now let P1 = MAX^2 and P0 = MSE. We then have PSNR = 10 log10(MAX^2/MSE) = 10 log10(MAX/(MSE)^(1/2))^2 = 20 log10(MAX/(MSE)^(1/2)). Therefore, PSNR = 20 log10(MAX/(MSE)^(1/2)).

Related Articles

How to Calculate Relative Standard Error
How to Convert Lumens to Candlepower
How to Convert Candle Power to Lumens
How to Calculate Absorbance
How to Calculate Eccentricity
How to Calculate the Coefficient of Variation
How to Calculate Angular Resolution
How to Calculate Reflectance
How Do Reflecting Telescopes Work?
How to Solve a Parabola
How to Calculate Magnification on a Light Microscope
How to Find the Minimum or Maximum in a Quadratic Equation
How Does Telescope Size Affect Resolving Power?
The Relationship Between Standard Deviations & Percentiles
The Best Lens for Taking Portraits
How to Convert mm Hg to in Hg
How to Calculate MSE
How to Calculate Test Accuracy Ratios
How to Calculate the Area of a Curved Surface
The Difference Between Qualitative & Quantitative Traits...