I am reading a book about yuv and rgb colorspace, it told me how YCbCr come out, these steps like this:
- R, G, B is a float number ranged 0.0~1.0
- use a grayscale method to convert RGB value to Lum value: Y = kr * R + kg * G + kb * B
- get a difference value between Y and RGB
Cr = R - Y
Cg = G - Y
Cb = B - Y
the book said: Cb + Cr + Cg is a constant and so only two of the three chroma components need to be stored or transmitted since the third component can always be calculated from the other two.[1]
I don't understand it. could anyone make a explaination for me?
[1]: H.264 and MPEG-4 Video Compression - Iain E. G. Richardson - P16
Look at the equations:
If you have Cr, Cg and Y, you can compute R and G. And with R, G and Y you can compute R from the relation
So,
Cb = B - Yis redundant. You can use the same logic to see that you need any two of the three chroma components.The statement “Cb + Cr + Cg is constant” does not make much sense to me, it is obviously false.
If the three
kvalues are all 1/3, then the sum is 0, but in general, the sum of the three chroma components depends on the color.