zoukankan      html  css  js  c++  java
  • The RGB to YCbCr formula

    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/

  • 相关阅读:
    JS异错面试题
    CSG
    OBS工具汇总
    SFS OBS
    zookeeper配置文件
    zookeeper概念
    centos yum源问题三板斧
    nexus仓库
    SVN备份恢复
    ubuntu
  • 原文地址:https://www.cnblogs.com/artestlove/p/4664026.html
Copyright © 2011-2022 走看看