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.

### Step 1

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

### Step 2

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.

### Step 3

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.

### Step 4

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.

### Step 5

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

#### Things You Will Need

- Calculator with statistical functions