问题描述
我正在尝试使用数学方法绘制CIE 1931色域。
I'm trying to plot the CIE 1931 color gamut using math.
我将xyY的颜色固定为1.0,然后将x和y从0.0更改为1.0。
I take a xyY color with Y fixed to 1.0 then vary x and y from 0.0 to 1.0.
如果我将生成的颜色绘制为图像(即(x,y)处的像素是我的xyY颜色转换为RGB),则会得到一张漂亮的图片CIE 1931色域位于中间,如下所示:
If I plot the resulting colors as an image (ie. the pixel at (x,y) is my xyY color converted to RGB) I get a pretty picture with the CIE 1931 color gamut somewhere in the middle of it, like this:
xyY从0.0到1.0:
xyY from 0.0 to 1.0:
现在我想要经典的舌头形图像,所以我的问题是:如何剔除CIE 1931色域范围之外的像素?
Now I want the classic tongue-shaped image so my question is: How do I cull pixels outside the range of the CIE 1931 color gamut?
ie。如何确定我的xyY颜色是否在CIE 1931颜色范围之内/之外?
ie. How can I tell if my xyY color is inside/outside the CIE 1931 color range?
推荐答案
您可以使用和 colour.is_within_visible_spectrum
定义:
>>> import numpy as np
>>> is_within_visible_spectrum(np.array([0.3205, 0.4131, 0.51]))
array(True, dtype=bool)
>>> a = np.array([[0.3205, 0.4131, 0.51],
... [-0.0005, 0.0031, 0.001]])
>>> is_within_visible_spectrum(a)
array([ True, False], dtype=bool)
注意该定义需要CIE XYZ三刺激值,因此您必须使用 colour.xyY_to_XYZ
定义将CIE xyY色彩空间值转换为XYZ。
Note that this definition expects CIE XYZ tristimulus values, so you would have to convert your CIE xyY colourspace values to XYZ by using colour.xyY_to_XYZ
definition.
这篇关于如何判断xyY颜色是否在CIE 1931色域内?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!