英文:
Why Cr+Cg+Cb is constant?
问题
我正在阅读一本关于YUV和RGB颜色空间的书,它告诉我YCbCr是如何产生的,步骤如下:
- R、G、B是在0.0~1.0范围内的浮点数。
- 使用灰度方法将RGB值转换为亮度值:Y = kr * R + kg * G + kb * B。
- 获取Y和RGB之间的差值:
Cr = R - Y
Cg = G - Y
Cb = B - Y
这本书说:Cb + Cr + Cg是一个常数,因此只需要存储或传输三个色度分量中的两个,因为第三个分量始终可以从其他两个分量计算得出。[1]
我不太理解这句话。是否有人可以为我解释一下?
[1]: H.264和MPEG-4视频压缩 - Iain E. G. Richardson - 第16页
。
英文:
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
答案1
得分: 1
看这些方程式:
Cr = R - Y
Cg = G - Y
如果你有Cr、Cg和Y,你可以计算出R和G。然后通过R、G和Y,你可以用以下关系计算R:
Y = kr * R + kg * G + kb * B
所以,Cb = B - Y 是多余的。你可以使用相同的逻辑来看出你只需要三个色度分量中的任意两个。
这个陈述“Cb + Cr + Cg 是常数”对我来说没有太多意义,显然是错误的。
Cb + Cr + Cg = R + G + B - 3Y =
= (1-3kr) * R + (1-3kg) * G + (1-3kb) * B
如果三个k值都是1/3,那么总和为0,但一般来说,三个色度分量的总和取决于颜色。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论