colour.models.XYZ_to_Iab#

colour.models.XYZ_to_Iab(XYZ: ArrayLike, LMS_to_LMS_p_callable: Callable, matrix_XYZ_to_LMS: ArrayLike, matrix_LMS_p_to_Iab: ArrayLike) ndarray[source]#

Convert from CIE XYZ tristimulus values to IPT-like \(Iab\) colour representation.

This definition is used to perform conversion from CIE XYZ tristimulus values to IPT colourspace and for other similar conversions. It implements a generic transformation from CIE XYZ tristimulus values to Lightness \(I\), \(a\) and \(b\) representing red-green dimension, i.e. the dimension lost by protanopes and the yellow-blue dimension, i.e. the dimension lost by tritanopes, respectively.

Parameters:
  • XYZ (ArrayLike) – CIE XYZ tristimulus values.

  • LMS_to_LMS_p_callable (Callable) – Callable applying the forward non-linearity to the \(LMS\) colourspace array.

  • matrix_XYZ_to_LMS (ArrayLike) – Matrix converting from CIE XYZ tristimulus values to \(LMS\) colourspace.

  • matrix_LMS_p_to_Iab (ArrayLike) – Matrix converting from non-linear \(LMS_p\) colourspace to IPT-like \(Iab\) colour representation.

Returns:

IPT-like \(Iab\) colour representation.

Return type:

numpy.ndarray

Notes

Domain

Scale - Reference

Scale - 1

XYZ

[0, 1]

[0, 1]

Range

Scale - Reference

Scale - 1

Iab

I : [0, 1]

a : [-1, 1]

b : [-1, 1]

I : [0, 1]

a : [-1, 1]

b : [-1, 1]

Examples

>>> XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
>>> LMS_to_LMS_p = lambda x: x ** 0.43
>>> M_XYZ_to_LMS = np.array(
...     [[0.4002, 0.7075, -0.0807],
...      [-0.2280, 1.1500, 0.0612],
...      [0.0000, 0.0000, 0.9184]])
>>> M_LMS_p_to_Iab = np.array(
...     [[0.4000, 0.4000, 0.2000],
...      [4.4550, -4.8510, 0.3960],
...      [0.8056, 0.3572, -1.1628]])
>>> XYZ_to_Iab(XYZ, LMS_to_LMS_p, M_XYZ_to_LMS, M_LMS_p_to_Iab)
... 
array([ 0.3842619...,  0.3848730...,  0.1888683...])