码迷,mamicode.com
首页 > 其他好文 > 详细

Why the RGB to YCbCr formula

时间:2015-07-21 14:15:45      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:

Why the RGB to YCbCr

We saw in the earlier post, Bitmap images used the R-G-B planes directly to represent colour images. But medical research proved that the human eye has different sensitivity to colour and brightness. Thus there came about the transformation of RGB to YCbCr.

Y: Luminance; Cb: Chrominance-Blue; and Cr: Chrominance-Red are the components. Luminance is very similar to the grayscale version of the original image. Cb is strong in case of parts of the image containing the sky (blue), both Cb and Cr are weak in case of a colour like green, and Cr is strong in places of occurrence of reddish colours.

The main question that comes to mind, is why this transformation. Medical investigation of the eye has led to findings that the rods some 120 million in number, are much more sensitive than the cones which are around 6-7 million in number. The rods are not sensitive to colour, while the cones which provide much of the eye’s colour sensitivity are found to be located close to a central region called the macula.

Well, the point of all this is that, we really do not need to keep all the information that is now represented in these colour frames (Cb and Cr) and thus these are usually sub-sampled (like in JPEG compression). The formulae for converting from RGB to YCbCr are given below.

Y = (77/256)R + (150/256)G + (29/256)B
Cb = ‐(44/256)R ‐ (87/256)G + (131/256)B + 128
Cr = (131/256)R ‐ (110/256)G ‐ (21/256)B + 128

The down-sampling of chrominance is done in 2 major variants used for most of the codecs.

  • 4:4:4 – In this, there is no sub-sampling of the chroma components, and can be as well referred and used directly as a RGB image. High-end scanners / cameras / capture devices use this format to not lose any data.
  • 4:2:2 – The chroma components are horizontally sub-sampled and their resolution is halved as compared to the luminance counterpart in this scheme. High-end digital video formats and still images generally employ this scheme.
  • 4:2:0 – In this variant, the chroma components are sub-sampled by a factor of 2, both horizontally as well as vertically, thus reducing to a factor of a quarter. The standard video compression MPEG uses this scheme.

This now prepares us to face the first steps in most compression techniques, the colour space transform followed by downsampling.

http:https://makarandtapaswi.wordpress.com/2009/07/20/why-the-rgb-to-ycbcr/

Why the RGB to YCbCr formula

标签:

原文地址:http://www.cnblogs.com/artestlove/p/4664026.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!