colour.RGB_to_XYZ#
- colour.RGB_to_XYZ(RGB: ArrayLike, colourspace: RGB_Colourspace | str, illuminant: ArrayLike | None = None, chromatic_adaptation_transform: Literal['Bianco 2010', 'Bianco PC 2010', 'Bradford', 'CAT02 Brill 2008', 'CAT02', 'CAT16', 'CMCCAT2000', 'CMCCAT97', 'Fairchild', 'Sharp', 'Von Kries', 'XYZ Scaling'] | str | None = 'CAT02', apply_cctf_decoding: bool = False, *args, **kwargs) NDArrayFloat [source]#
Convert given RGB colourspace array to CIE XYZ tristimulus values.
- Parameters:
RGB (ArrayLike) – RGB colourspace array.
colourspace (RGB_Colourspace | str) – Input RGB colourspace.
illuminant (ArrayLike | None) – CIE xy chromaticity coordinates or CIE xyY colourspace array of the illuminant for the output CIE XYZ tristimulus values.
chromatic_adaptation_transform (Literal['Bianco 2010', 'Bianco PC 2010', 'Bradford', 'CAT02 Brill 2008', 'CAT02', 'CAT16', 'CMCCAT2000', 'CMCCAT97', 'Fairchild', 'Sharp', 'Von Kries', 'XYZ Scaling'] | str | None) – Chromatic adaptation transform, if None no chromatic adaptation is performed.
apply_cctf_decoding (bool) – Apply the RGB colourspace decoding colour component transfer function / opto-electronic transfer function.
args – Arguments for deprecation management.
kwargs – Keywords arguments for deprecation management.
- Returns:
CIE XYZ tristimulus values.
- Return type:
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
>>> from colour.models import RGB_COLOURSPACE_sRGB >>> RGB = np.array([0.45595571, 0.03039702, 0.04087245]) >>> illuminant = np.array([0.34570, 0.35850]) >>> RGB_to_XYZ(RGB, RGB_COLOURSPACE_sRGB, illuminant, "Bradford") ... array([ 0.2163881..., 0.1257 , 0.0384749...]) >>> RGB_to_XYZ(RGB, "sRGB", illuminant, "Bradford") ... array([ 0.2163881..., 0.1257 , 0.0384749...])