colour.XYZ_to_RGB¶
-
colour.
XYZ_to_RGB
(XYZ, illuminant_XYZ, illuminant_RGB, XYZ_to_RGB_matrix, chromatic_adaptation_transform='CAT02', encoding_cctf=None)[source]¶ Converts from CIE XYZ tristimulus values to RGB colourspace array.
Parameters: - XYZ (array_like) – CIE XYZ tristimulus values.
- illuminant_XYZ (array_like) – CIE XYZ tristimulus values illuminant xy chromaticity coordinates or CIE xyY colourspace array.
- illuminant_RGB (array_like) – RGB colourspace illuminant xy chromaticity coordinates or CIE xyY colourspace array.
- XYZ_to_RGB_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.
- encoding_cctf (object, optional) – Encoding colour component transfer function (Encoding CCTF) or opto-electronic transfer function (OETF / OECF).
Returns: RGB colourspace array.
Return type: ndarray
Notes
Domain Scale - Reference Scale - 1 XYZ
[0, 1] [0, 1] illuminant_XYZ
[0, 1] [0, 1] illuminant_RGB
[0, 1] [0, 1] Range Scale - Reference Scale - 1 RGB
[0, 1] [0, 1] Examples
>>> XYZ = np.array([0.21638819, 0.12570000, 0.03847493]) >>> illuminant_XYZ = np.array([0.34570, 0.35850]) >>> illuminant_RGB = np.array([0.31270, 0.32900]) >>> chromatic_adaptation_transform = 'Bradford' >>> XYZ_to_RGB_matrix = np.array( ... [[3.24062548, -1.53720797, -0.49862860], ... [-0.96893071, 1.87575606, 0.04151752], ... [0.05571012, -0.20402105, 1.05699594]] ... ) >>> XYZ_to_RGB(XYZ, illuminant_XYZ, illuminant_RGB, XYZ_to_RGB_matrix, ... chromatic_adaptation_transform) # doctest: +ELLIPSIS array([ 0.4559557..., 0.0303970..., 0.0408724...])