从矩阵表 YCbCr 到 RGB
下面是将 RGB 转换为 YCbCr 的矩阵。你能告诉我如何获得将 YCbCr 转换为 RGB 的公式吗? 我的意思是,我有可用的 YCbCr 值,并且我想从中获取 RGB。
Below is a matrix to convert RGB to YCbCr. Can you tell me how can I get formula to convert YCbCr to RGB?
I mean, I have YCbCr value available and I want to get RGB from it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
如果您询问公式是如何推导的,您可能需要搜索“颜色坐标系”。 此页面特别对 YCbCr 空间进行了很好的讨论。
我们知道几乎任何颜色都可以表示为红、绿、蓝的线性组合。但是您可以转换(或“旋转”)该坐标系,使三个基本元素不再是 RGB,而是其他元素。对于YCbCr,Y层是亮度层,Cb和Cr是两个色度层。 Cb 与蓝色的相关性更密切,Cr 与红色的相关性更密切。
YCbCr 通常是首选,因为人类视觉系统对亮度的变化比对色度的定量等效变化更敏感。因此,诸如 JPEG 之类的图像编码器可以比亮度层更多地压缩两个色度层,从而获得更高的压缩比。
编辑:我误解了这个问题。 (您应该编辑它以澄清。)这是从 YCbCr 获取 RGB 的公式,取自上面的 链接:
If you are asking how the formula is derived, you may want to search for "color coordinate systems". This page has a good discussion on the YCbCr space, in particular.
We know that almost any color can be represented as a linear combination of red, green, and blue. But you can transform (or "rotate") that coordinate system such that the three basis elements are no longer RGB, but something else. In the case of YCbCr, the Y layer is the luminance layer, and Cb and Cr are the two chrominance layers. Cb correlates more closely to blue, and Cr correlates more closely to red.
YCbCr is often preferred because the human visual system is more sensitive to changes in luminance than quantitatively equivalent changes in chrominance. Therefore, an image coder such as JPEG can compress the two chrominance layers more than the luminance layer, resulting in a higher compression ratio.
EDIT: I misunderstood the question. (You should edit it to clarify.) Here is the formula to get RGB from YCbCr, taken from the above link:
我不会考虑
round
部分,但由于M
看起来是可逆的:您可以对结果向量进行舍入。
I'm not going to account for the
round
portion, but sinceM
looks invertible:You can round the resulting vector.
http://www.fourcc.org/fccyvrgb.php 具有 YUV 到 RGB 的转换。
http://www.fourcc.org/fccyvrgb.php has YUV to RGB conversions.
转换为浮点数并应用(因为系数为 BT.709-2):
https://en.wikipedia.org/wiki/YCbCr#ITU-R_BT.709_conversion
Convert to float and apply (since the coeff. are BT.709-2):
https://en.wikipedia.org/wiki/YCbCr#ITU-R_BT.709_conversion
这些是适用于 0-255 颜色的方程式。在这里,它们是 C 语言
RGB 到 YCBCR
YCBCR 到 RGB
These are the equations that work for 0-255 colors. Here they are in C
RGB to YCBCR
YCBCR to RGB