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 colourspace 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 colourspace 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 CIE XYZ_1 colourspace stimulus from test viewing conditions to reference viewing conditions using CIE 1994 chromatic adaptation model.

Parameters:
  • XYZ (array_like, (3,)) – CIE XYZ colourspace matrix of test sample / stimulus in domain [0, 100].
  • xy_o1 (array_like, (2,)) – Chromaticity coordinates \(x_{o1}\) and \(y_{o1}\) of test illuminant and background.
  • xy_o2 (array_like, (2,)) – 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 colourspace test stimulus.

Return type:

ndarray, (3,)

Warning

The input domain of that definition is non standard!

Notes

  • Input CIE XYZ_1 colourspace matrix is in domain [0, 100].
  • Output CIE XYZ_2 colourspace matrix is in domain [0, 100].

Examples

>>> XYZ_1 = np.array([28.0, 21.26, 5.27])
>>> xy_o1 = (0.4476, 0.4074)
>>> xy_o2 = (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 colourspace to cone responses.

Parameters:XYZ (array_like, (3,)) – CIE XYZ colourspace matrix.
Returns:Cone responses.
Return type:ndarray, (3,)

Examples

>>> XYZ = np.array([28.0, 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 colourspace.

Parameters:RGB (array_like, (3,)) – Cone responses.
Returns:CIE XYZ colourspace matrix.
Return type:ndarray, (3,)

Examples

>>> RGB = np.array([25.8244273, 18.6791422, 4.8390194])
>>> 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, (2,)) – Chromaticity coordinates \(x_o\) and \(y_o\) of whitepoint.
Returns:Intermediate values \(\xi\), \(\eta\), \(\zeta\).
Return type:ndarray, (3,)

Examples

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

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

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

Effective adapting responses.

Return type:

ndarray, (3,)

Examples

>>> Y_o = 20
>>> E_o = 1000
>>> xez = np.array([1.11857195, 0.9329553, 0.32680879])
>>> effective_adapting_responses(Y_o, E_o, xez)  
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) – Middle and long-wavelength sensitive cone response.
Returns:Exponent \(\beta_1\).
Return type:numeric

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) – Short-wavelength sensitive cone response.
Returns:Exponent \(\beta_2\).
Return type:numeric

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 (ndarray, (3,)) – Cone responses.
Returns:Chromatic adaptation exponential factors \(\beta_1(R_o)\), \(\beta_1(G_o)\) and \(\beta_2(B_o)\).
Return type:ndarray, (3,)

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(Y_o, xez_1, xez_2, bRGB_o1, bRGB_o2, n=1)[source]

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

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

Coefficient \(K\).

Return type:

numeric

Examples

>>> Y_o = 20
>>> xez_1 = np.array([1.11857195, 0.9329553, 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])
>>> K_coefficient(Y_o, xez_1, xez_2, bRGB_o1, bRGB_o2)
1.0
colour.adaptation.cie1994.corresponding_colour(RGB_1, Y_o, xez_1, xez_2, bRGB_o1, bRGB_o2, K, n=1)[source]

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

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

Corresponding colour cone responses of given test sample cone responses.

Return type:

ndarray, (3,)

Examples

>>> RGB_1 = np.array([25.8244273, 18.6791422, 4.8390194])
>>> Y_o = 20
>>> xez_1 = np.array([1.11857195, 0.9329553, 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])
>>> K = 1.0
>>> corresponding_colour(RGB_1, Y_o, xez_1, xez_2, bRGB_o1, bRGB_o2, K)    
array([ 23.1636901...,  20.0211948...,  16.2001664...])