Yxy 到 RGB 的转换 [英] Yxy to RGB conversion
问题描述
我正在尝试实现从 Yxy 颜色空间到 RGB 的转换方法.这是通过首先转换为 XYZ 而不是 RGB 来完成的.我发现 Yxy -> XYZ 的官方"矩阵是
<前>3.2410 -1.5374 -0.4986-0.9692 1.8760 0.04160.0556 -0.2040 1.0570这也是 Matt Pharr 的《基于物理的渲染》一书中使用的方法.
另一方面,3D图形领域的许多人使用
<前>2.5651-1.1665 -0.3986-1.0217 1.9777 0.04390.0753 -0.2543 1.1892现在,据我所知,如果 x= 0.33333 和 y=0.33333,Yxy 会显示灰色阴影.这确实是我用第二个矩阵得到的.第一个创建红色 RGB 值.
第二个矩阵有效,但它来自哪里?我发现很多人在他们的示例代码中使用它,但没有人真正解释它是否有物理背景.
提前致谢
从 xyY 到 XYZ 的转换是非线性的,即不能通过矩阵乘法来计算.来自 CIE 1931 色彩空间的维基百科:
X = Y/y * xZ = Y/y * ( 1 - x - y )
您的两个矩阵似乎都用于 XYZ 到 RGB 的转换.第一个由 sRGB 原色和白点给出.第二个原色非常接近 sRGB(绿色有 x = 0.29
, y = 0.60
)和一个 x = 0.334
, y= 0.334
白点.
如果您想使用其他 RGB 原色和白点,请查看以下列表:http://brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
I am trying to implement a conversion method from Yxy color space to RGB. This is done by first converting to XYZ and than to RGB. I found out that the "official" matrix for Yxy -> XYZ is
3.2410 -1.5374 -0.4986 -0.9692 1.8760 0.0416 0.0556 -0.2040 1.0570
This is also the one used in Matt Pharr's book Physically Based Rendering.
On the other hand, many people in 3D graphics area use
2.5651-1.1665 -0.3986 -1.0217 1.9777 0.0439 0.0753 -0.2543 1.1892
Now, as far as I understand if x= 0.33333 and y=0.33333, Yxy gives a gray shade. This is indeed what I obtain with the second matrix. The first one creates a red RGB value.
The second matrix works but where does it come from? I find many people using it in their example codes but nobody really explains if it has a physical background.
Thanks in advance
The conversion from xyY to XYZ is non-linear, i.e. it cannot be computed by a matrix multiplication. From the Wikipedia on the CIE 1931 color space:
X = Y / y * x
Z = Y / y * ( 1 - x - y )
Both your matrices seem to be for the XYZ to RGB conversion. The first given by the sRGB primaries and white point. The second by primaries very close to sRGB (green has x = 0.29
, y = 0.60
) and a x = 0.334
, y = 0.334
white point.
If you wish to use other RGB primaries and white point, there is a list at: http://brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
这篇关于Yxy 到 RGB 的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!