In image compression applications, I know that for an $8$-bit $0$ to $255$ level grayscale image the PSNR (peak signal to noise ratio) can be defined as: $$ \text{PSNR} = 10 \log_{10} \frac{\sum_{m,n} 255^2}{\sum_{m, n}|s(m,n)-\hat{s}(m,n)|^2} $$

where $s$ is the original 2D image and $\hat{s}$ is the reconstructed image (decompressed). My question is how does one define PSNR (or even SNR for that matter) in 3 color space like a 3 channel RGB image, in which each pixel is associated with a 3-tuple $(R, G, B)$, where $R$ is a Byte representing the value of Red channel and so forth, assuming that the image is an 8-bit depth image.


1 Answer 1


Your PSNR formula has in the denominator a sum of squared distances in a color intensity 1-D space between original and reconstructed pixel values, the sum is taken over all the image pixels. Therefore, you question can be re-formulated as "how one defines a distance in a color 3-D space".

You did give an implicit answer, one of many possible and still valid, in your question: your elaboration on the definition of color space ("each pixel is associated with a 3-tuple (R,G,B)") suggests that you consider the RGB color space. The Euclidian metric can be selected and you have the formula for a color distance between two color vectors F1 and F2 $$ Δ_{RGB}(F_1, F_2) = \sqrt{(R_1-R_2)^2+(G_1-G_2)^2+(B_1-B_2)^2} $$ and it is true, but not the whole truth.

The practical usefulness of the color distance definition is task specific. From one point of view, it depends on what is the purpose you assign to your image analysis instrumentation. Considering the image impairment by a reconstruction noise, you may want to select a color space adapted to human vision, a perception based color space, as a hue-saturation-intensity (HSI) color space. The metric in HSI used for color distance calculations is $$ Δ_{RGB}(F_1, F_2) = \sqrt{Δ_I^2+Δ_C^2} \\ Δ_I = |I_1-I_2|; Δ_C=\sqrt{S_1^2+S_2^2-2S_1S_2cosθ} \\ θ = (|H_1-H_2|<π)?(|H_1-H_2|):(2π-|H_1-H_2|) $$ In the other project, you may want to construct an image from measurement data for presentation in pseudo colors. It will require to work with the proprietary color space that reflects transfer functions of your detectors.

Summing up, your project may require a standard color space, and you simply select the best color space for your task, or it is a sophisticated research work, and to define a PSNR formula for your image processing is a work of its own.

About "color spaces": a search for "distance in color image space" gives as a first entry an article that I readily recommend to you: https://profs.info.uaic.ro/~ancai/DIP/laborator/lab7/color%20spaces%20&%20distances.pdf

In the article, a section 3.4.3 Opponent Color Spaces (page 62, or 26/34 in the pdf) may be what is of special interest for you.

  • $\begingroup$ Thank you for your detailed answer. So in effect, you are saying that one way to define PSNR for 3 color spaces would be: $$\text{PSNR} = \frac{255^2 + 255^2 + 255^2}{\sum_n \Delta_{RGB}(s_n, \hat{s}_n)}$$ correct? $\endgroup$
    – Iconoclast
    Commented Dec 7, 2020 at 12:22
  • $\begingroup$ I am not discussing the numerator; but, for that matter, if the purpose of the numerator in PSNR is to "normalize" the SNR parameter in any way, is not that a concern for you, that for your PSNR thus defined, both gray and color formulas, the denominator, being a sum over all the pixels, increases (roughly speaking) proportional to an image area, while the numerator stay fixed? And also, the ratio tends to be greater for dimmer images irrespective of their restoration quality? $\endgroup$
    – V.V.T
    Commented Dec 8, 2020 at 2:17
  • $\begingroup$ Yes I realize I am making a mistake, the numerator should be:$$ 3\sum_n255^2$$. $\endgroup$
    – Iconoclast
    Commented Dec 8, 2020 at 6:45
  • $\begingroup$ Yes, you are right these are the short-comings of this definition. But it is widely used in image compression ar least for gray scale images. $\endgroup$
    – Iconoclast
    Commented Dec 8, 2020 at 6:48

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.