I need to obtain the CIE x and y coordinates from the chromaticity diagram. I tried the following: take an RGB point, convert to sRGB, plot it. Separately convert the RGB to xyY, and compare the results.
import numpy as np
from colour.plotting import *
import colour
rgb = np.array([100,50,200])
RGB = colour.models.eotf_inverse_sRGB(rgb / 255)
plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931(RGB)
So the coordinates that I am looking for are around [0.3, 0.26]. As far as I understand to get them I need to transform RGB to XYZ, and take XY coordinates. I found the following solution:
illuminant_RGB = np.array([0.31270, 0.32900])
illuminant_XYZ = np.array([0.34570, 0.35850])
chromatic_adaptation_transform = 'Bradford'
RGB_to_XYZ_matrix = np.array([[0.41240000, 0.35760000, 0.18050000],
[0.21260000, 0.71520000, 0.07220000],
[0.01930000, 0.11920000, 0.95050000]])
result = colour.RGB_to_XYZ(rgb/255., illuminant_RGB, illuminant_XYZ, RGB_to_XYZ_matrix, chromatic_adaptation_transform)
colour.XYZ_to_xyY(result)
However that produces [ 0.29439225, 0.22595116, 0.27536142]
, which is not correct.