http://blog.csdn.net/a14730497/article/details/17886127
Y: Luminance (luminance or luma), which is the gray scale value. "Brightness" is established through the RGB input signal by overlaying specific portions of the RGB signal together.
Cb: Reflects the difference between the blue part of the RGB input signal and the luminance value of the RGB signal.
Cr: Reflects the difference between the red part of the RGB input signal and the luminance value of the RGB signal.
In the following two formulas, the values of the RGB and YCBCR components are in the range of 0-255.
Convert RGB to YCbCr
Y = 0.257*r+0.564*g+0.098*b+16
Cb = -0.148*r-0.291*g+0.439*b+128
Cr = 0.439*r-0.368*g-0.071*b+128
The equivalent is:
Y = (1/8192) [(135168 + 4129G) + (2015R + 803B)] Other CB, Cr similar process
//------------------------------------------------------------------------------------------------------------- ------------------
Convert YCbCr to RGB
R = 1.164* (Y-16) +1.596* (Cr-128)
G = 1.164* (Y-16) -0.392* (Cb-128) -0.813* (Cr-128)
B = 1.164* (Y-16) +2.017* (Cb-128)
Or
R = 1.164Y + 1.596cr-222.912
G = 1.164Y-0.391CB-0.813CR + 135.488
B = 1.164Y + 2.018cb-276.928
The equivalent is:
R >> 9 = 596Y + 817cr-114131
G >> 9 = 596y-200cb-416cr + 69370
B >> 9 = 596Y + 1033cb-141787
The mutual conversion formula between RGB and YCBCR color space