Why Cr+Cg+Cb is constant?

97 views Asked by At

I am reading a book about yuv and rgb colorspace, it told me how YCbCr come out, these steps like this:

  1. R, G, B is a float number ranged 0.0~1.0
  2. use a grayscale method to convert RGB value to Lum value: Y = kr * R + kg * G + kb * B
  3. 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

1

There are 1 answers

0
Cris Luengo On

Look at the equations:

Cr = R - Y
Cg = G - Y

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

Y = kr * R + kg * G + kb * B

So, Cb = B - Y is 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.

Cb + Cr + Cg = R + G + B - 3*Y =
= (1-3*kr) * R + (1-3*kg) * G + (1-3*kb) * B

If the three k values are all 1/3, then the sum is 0, but in general, the sum of the three chroma components depends on the color.