PSNR is most easily defined via the
mean squared error (
MSE). Given a noise-free
m×
n monochrome image
I and its noisy approximation
K,
MSE is defined as : \mathit{MSE} = \frac{1}{m\,n}\sum_{i=0}^{m-1}\sum_{j=0}^{n-1} [I(i,j) - K(i,j)]^2. The PSNR (in
dB) is defined as : \begin{align} \mathit{PSNR} &= 10 \cdot \log_{10} \left( \frac{\mathit{MAX}_I^2}{\mathit{MSE}} \right) \\ &= 20 \cdot \log_{10} \left( \frac{\mathit{MAX}_I}{\sqrt{\mathit{MSE}}} \right) \\ &= 20 \cdot \log_{10}(\mathit{MAX}_I) - 10 \cdot \log_{10} (\mathit{MSE}). \end{align} Here,
MAXI is the maximum possible pixel value of the image. When the pixels are represented using 8 bits per sample, this is 255. More generally, when samples are represented using linear
PCM with
B bits per sample,
MAXI is 2B − 1.
Application in color images For
RGB color images, with three values per pixel, the definition of PSNR is the same except that the MSE is the sum over all squared value differences (now for each color, i.e. three times as many differences as in a monochrome image) divided by image size and by three. Alternately, for color images the image is converted to a different
color space and PSNR is reported against each channel of that color space, e.g.,
YCbCr or
HSL. == Quality estimation with PSNR ==