colour.RGB_to_XYZ¶
-
colour.
RGB_to_XYZ
(RGB, illuminant_RGB, illuminant_XYZ, RGB_to_XYZ_matrix, chromatic_adaptation_transform='CAT02', decoding_cctf=None)[source]¶ Converts given RGB colourspace array to CIE XYZ tristimulus values.
Parameters: - RGB (array_like) – RGB colourspace array.
- illuminant_RGB (array_like) – RGB colourspace illuminant chromaticity coordinates or CIE xyY colourspace array.
- illuminant_XYZ (array_like) – CIE XYZ tristimulus values illuminant chromaticity coordinates or CIE xyY colourspace array.
- RGB_to_XYZ_matrix (array_like) – Normalised primary matrix.
- chromatic_adaptation_transform (unicode, optional) – {‘CAT02’, ‘XYZ Scaling’, ‘Von Kries’, ‘Bradford’, ‘Sharp’, ‘Fairchild’, ‘CMCCAT97’, ‘CMCCAT2000’, ‘CAT02_BRILL_CAT’, ‘Bianco’, ‘Bianco PC’, None}, Chromatic adaptation transform, if None no chromatic adaptation is performed.
- decoding_cctf (object, optional) – Decoding colour component transfer function (Decoding CCTF) or electro-optical transfer function (EOTF / EOCF).
Returns: CIE XYZ tristimulus values.
Return type: ndarray
Notes
Domain Scale - Reference Scale - 1 RGB
[0, 1] [0, 1] illuminant_XYZ
[0, 1] [0, 1] illuminant_RGB
[0, 1] [0, 1] Range Scale - Reference Scale - 1 XYZ
[0, 1] [0, 1] Examples
>>> RGB = np.array([0.45595571, 0.03039702, 0.04087245]) >>> 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]] ... ) >>> RGB_to_XYZ(RGB, illuminant_RGB, illuminant_XYZ, RGB_to_XYZ_matrix, ... chromatic_adaptation_transform) # doctest: +ELLIPSIS array([ 0.2163881..., 0.1257 , 0.0384749...])