colour.adaptation.cie1994 Module

CIE 1994 Chromatic Adaptation Model

Defines CIE 1994 chromatic adaptation model objects:

References

[1]CIE TC 1-32. (1994). CIE 109-1994 A Method of Predicting Corresponding Colours under Different Chromatic and Illuminance Adaptations (pp. 1–18). ISBN:978-3-900734-51-0
colour.adaptation.cie1994.CIE1994_XYZ_TO_RGB_MATRIX = array([[ 0.40024, 0.7076 , -0.08081], [-0.2263 , 1.16532, 0.0457 ], [ 0. , 0. , 0.91822]])

CIE 1994 colour appearance model CIE XYZ tristimulus values to cone responses matrix.

CIE1994_XYZ_TO_RGB_MATRIX : array_like, (3, 3)

colour.adaptation.cie1994.CIE1994_RGB_TO_XYZ_MATRIX = array([[ 1.85993639e+00, -1.12938162e+00, 2.19897410e-01], [ 3.61191436e-01, 6.38812463e-01, -6.37059684e-06], [ 0.00000000e+00, 0.00000000e+00, 1.08906362e+00]])

CIE 1994 colour appearance model cone responses to CIE XYZ tristimulus values matrix.

CIE1994_RGB_TO_XYZ_MATRIX : array_like, (3, 3)

colour.adaptation.cie1994.chromatic_adaptation_CIE1994(XYZ_1, xy_o1, xy_o2, Y_o, E_o1, E_o2, n=1)[source]

Adapts given stimulus CIE XYZ_1 tristimulus values from test viewing conditions to reference viewing conditions using CIE 1994 chromatic adaptation model.

Parameters:
  • XYZ (array_like) – CIE XYZ tristimulus values of test sample / stimulus in domain [0, 100].
  • xy_o1 (array_like) – Chromaticity coordinates \(x_{o1}\) and \(y_{o1}\) of test illuminant and background.
  • xy_o2 (array_like) – Chromaticity coordinates \(x_{o2}\) and \(y_{o2}\) of reference illuminant and background.
  • Y_o (numeric) – Luminance factor \(Y_o\) of achromatic background as percentage in domain [18, 100].
  • E_o1 (numeric) – Test illuminance \(E_{o1}\) in \(cd/m^2\).
  • E_o2 (numeric) – Reference illuminance \(E_{o2}\) in \(cd/m^2\).
  • n (numeric, optional) – Noise component in fundamental primary system.
Returns:

Adapted CIE XYZ_2 tristimulus values of test stimulus.

Return type:

ndarray

Warning

The input domain of that definition is non standard!

Notes

  • Input CIE XYZ_1 tristimulus values are in domain [0, 100].
  • Output CIE XYZ_2 tristimulus values are in domain [0, 100].

Examples

>>> XYZ_1 = np.array([28.00, 21.26, 5.27])
>>> xy_o1 = np.array([0.4476, 0.4074])
>>> xy_o2 = np.array([0.3127, 0.3290])
>>> Y_o = 20
>>> E_o1 = 1000
>>> E_o2 = 1000
>>> chromatic_adaptation_CIE1994(  
...     XYZ_1, xy_o1, xy_o2, Y_o, E_o1, E_o2)
array([ 24.0337952...,  21.1562121...,  17.6430119...])
colour.adaptation.cie1994.XYZ_to_RGB_cie1994(XYZ)[source]

Converts from CIE XYZ tristimulus values to cone responses.

Parameters:XYZ (array_like) – CIE XYZ tristimulus values.
Returns:Cone responses.
Return type:ndarray

Examples

>>> XYZ = np.array([28.00, 21.26, 5.27])
>>> XYZ_to_RGB_cie1994(XYZ)  
array([ 25.8244273...,  18.6791422...,   4.8390194...])
colour.adaptation.cie1994.RGB_to_XYZ_cie1994(RGB)[source]

Converts from cone responses to CIE XYZ tristimulus values.

Parameters:RGB (array_like) – Cone responses.
Returns:CIE XYZ tristimulus values.
Return type:ndarray

Examples

>>> RGB = np.array([25.82442730, 18.67914220, 4.83901940])
>>> RGB_to_XYZ_cie1994(RGB)  
array([ 28.  ,  21.26,   5.27])
colour.adaptation.cie1994.intermediate_values(xy_o)[source]

Returns the intermediate values \(\xi\), \(\eta\), \(\zeta\).

Parameters:xy_o (array_like) – Chromaticity coordinates \(x_o\) and \(y_o\) of whitepoint.
Returns:Intermediate values \(\xi\), \(\eta\), \(\zeta\).
Return type:ndarray

Examples

>>> xy_o = np.array([0.4476, 0.4074])
>>> intermediate_values(xy_o)  
array([ 1.1185719...,  0.9329553...,  0.3268087...])
colour.adaptation.cie1994.effective_adapting_responses(xez, Y_o, E_o)[source]

Derives the effective adapting responses in the fundamental primary system of the test or reference field.

Parameters:
  • xez (ndarray) – Intermediate values \(\xi\), \(\eta\), \(\zeta\).
  • E_o (numeric) – Test or reference illuminance \(E_{o}\) in lux.
  • Y_o (numeric) – Luminance factor \(Y_o\) of achromatic background as percentage in domain [18, 100].
Returns:

Effective adapting responses.

Return type:

ndarray

Examples

>>> xez = np.array([1.11857195, 0.93295530, 0.32680879])
>>> E_o = 1000
>>> Y_o = 20
>>> effective_adapting_responses(xez, Y_o, E_o)  
array([ 71.2105020...,  59.3937790...,  20.8052937...])
colour.adaptation.cie1994.beta_1(x)[source]

Computes the exponent \(\beta_1\) for the middle and long-wavelength sensitive cones.

Parameters:x (numeric or array_like) – Middle and long-wavelength sensitive cone response.
Returns:Exponent \(\beta_1\).
Return type:numeric or array_like

Examples

>>> beta_1(318.323316315)  
4.6106222...
colour.adaptation.cie1994.beta_2(x)[source]

Computes the exponent \(\beta_2\) for the short-wavelength sensitive cones.

Parameters:x (numeric or array_like) – Short-wavelength sensitive cone response.
Returns:Exponent \(\beta_2\).
Return type:numeric or array_like

Examples

>>> beta_2(318.323316315)  
4.6522416...
colour.adaptation.cie1994.exponential_factors(RGB_o)[source]

Returns the chromatic adaptation exponential factors \(\beta_1(R_o)\), \(\beta_1(G_o)\) and \(\beta_2(B_o)\) of given cone responses.

Parameters:RGB_o (array_like) – Cone responses.
Returns:Chromatic adaptation exponential factors \(\beta_1(R_o)\), \(\beta_1(G_o)\) and \(\beta_2(B_o)\).
Return type:ndarray

Examples

>>> RGB_o = np.array([318.32331631, 318.30352317, 318.23283482])
>>> exponential_factors(RGB_o)  
array([ 4.6106222...,  4.6105892...,  4.6520698...])
colour.adaptation.cie1994.K_coefficient(xez_1, xez_2, bRGB_o1, bRGB_o2, Y_o, n=1)[source]

Computes the coefficient \(K\) for correcting the difference between the test and references illuminances.

Parameters:
  • xez_1 (array_like) – Intermediate values \(\xi_1\), \(\eta_1\), \(\zeta_1\) for the test illuminant and background.
  • xez_2 (array_like) – Intermediate values \(\xi_2\), \(\eta_2\), \(\zeta_2\) for the reference illuminant and background.
  • bRGB_o1 (array_like) – Chromatic adaptation exponential factors \(\beta_1(R_{o1})\), \(\beta_1(G_{o1})\) and \(\beta_2(B_{o1})\) of test sample.
  • bRGB_o2 (array_like) – Chromatic adaptation exponential factors \(\beta_1(R_{o2})\), \(\beta_1(G_{o2})\) and \(\beta_2(B_{o2})\) of reference sample.
  • Y_o (numeric or array_like) – Luminance factor \(Y_o\) of achromatic background as percentage in domain [18, 100].
  • n (numeric or array_like, optional) – Noise component in fundamental primary system.
Returns:

Coefficient \(K\).

Return type:

numeric or array_like

Examples

>>> xez_1 = np.array([1.11857195, 0.93295530, 0.32680879])
>>> xez_2 = np.array([1.00000372, 1.00000176, 0.99999461])
>>> bRGB_o1 = np.array([3.74852518, 3.63920879, 2.78924811])
>>> bRGB_o2 = np.array([3.68102374, 3.68102256, 3.56557351])
>>> Y_o = 20
>>> K_coefficient(xez_1, xez_2, bRGB_o1, bRGB_o2, Y_o)
1.0
colour.adaptation.cie1994.corresponding_colour(RGB_1, xez_1, xez_2, bRGB_o1, bRGB_o2, Y_o, K, n=1)[source]

Computes the corresponding colour cone responses of given test sample cone responses \(RGB_1\).

Parameters:
  • RGB_1 (array_like) – Test sample cone responses \(RGB_1\). Intermediate values \(\xi_1\), \(\eta_1\), \(\zeta_1\) for the test illuminant and background.
  • xez_1 (array_like) –
  • xez_2 (array_like) – Intermediate values \(\xi_2\), \(\eta_2\), \(\zeta_2\) for the reference illuminant and background.
  • bRGB_o1 (array_like) – Chromatic adaptation exponential factors \(\beta_1(R_{o1})\), \(\beta_1(G_{o1})\) and \(\beta_2(B_{o1})\) of test sample.
  • bRGB_o2 (array_like) – Chromatic adaptation exponential factors \(\beta_1(R_{o2})\), \(\beta_1(G_{o2})\) and \(\beta_2(B_{o2})\) of reference sample.
  • Y_o (numeric or array_like) – Luminance factor \(Y_o\) of achromatic background as percentage in domain [18, 100].
  • K (numeric or array_like) – Coefficient \(K\).
  • n (numeric or array_like, optional) – Noise component in fundamental primary system.
Returns:

Corresponding colour cone responses of given test sample cone responses.

Return type:

ndarray

Examples

>>> RGB_1 = np.array([25.82442730, 18.67914220, 4.83901940])
>>> xez_1 = np.array([1.11857195, 0.93295530, 0.32680879])
>>> xez_2 = np.array([1.00000372, 1.00000176, 0.99999461])
>>> bRGB_o1 = np.array([3.74852518, 3.63920879, 2.78924811])
>>> bRGB_o2 = np.array([3.68102374, 3.68102256, 3.56557351])
>>> Y_o = 20
>>> K = 1.0
>>> corresponding_colour(  
...     RGB_1, xez_1, xez_2, bRGB_o1, bRGB_o2, Y_o, K)
array([ 23.1636901...,  20.0211948...,  16.2001664...])