colour.adaptation.fairchild1990 Module

Fairchild (1990) Chromatic Adaptation Model

Defines Fairchild (1990) chromatic adaptation model objects:

References

[1]Fairchild, M. D. (1991). Formulation and testing of an incomplete-chromatic-adaptation model. Color Research & Application, 16(4), 243–250. doi:10.1002/col.5080160406
[2]Fairchild, M. D. (2013). FAIRCHILD’S 1990 MODEL. In Color Appearance Models (3rd ed., pp. 4418–4495). Wiley. ASIN:B00DAYO8E2
colour.adaptation.fairchild1990.FAIRCHILD1990_XYZ_TO_RGB_MATRIX = array([[ 0.40024, 0.7076 , -0.08081], [-0.2263 , 1.16532, 0.0457 ], [ 0. , 0. , 0.91822]])

Fairchild (1990) colour appearance model CIE XYZ colourspace to cone responses matrix.

FAIRCHILD1990_XYZ_TO_RGB_MATRIX : array_like, (3, 3)

colour.adaptation.fairchild1990.FAIRCHILD1990_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]])

Fairchild (1990) colour appearance model cone responses to CIE XYZ colourspace to matrix.

FAIRCHILD1990_RGB_TO_XYZ_MATRIX : array_like, (3, 3)

colour.adaptation.fairchild1990.chromatic_adaptation_Fairchild1990(XYZ_1, XYZ_n, XYZ_r, Y_n, discount_illuminant=False)[source]

Adapts given CIE XYZ_1 colourspace stimulus from test viewing conditions to reference viewing conditions using Fairchild (1990) chromatic adaptation model.

Parameters:
  • XYZ_1 (array_like, (3,)) – CIE XYZ_1 colourspace matrix of test sample / stimulus in domain [0, 100].
  • XYZ_n (array_like, (3,)) – Test viewing condition CIE XYZ_n colourspace whitepoint matrix.
  • XYZ_r (array_like, (3,)) – Reference viewing condition CIE XYZ_r colourspace whitepoint matrix.
  • Y_n (numeric) – Luminance \(Y_n\) of test adapting stimulus in \(cd/m^2\).
  • discount_illuminant (bool, optional) – Truth value indicating if the illuminant should be discounted.
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, CIE XYZ_n and CIE XYZ_r colourspace matrices are in domain [0, 100].
  • Output CIE XYZ_2 colourspace matrix is in domain [0, 100].

Examples

>>> XYZ_1 = np.array([19.53, 23.07, 24.97])
>>> XYZ_n = np.array([111.15, 100.00, 35.20])
>>> XYZ_r = np.array([94.81, 100.00, 107.30])
>>> Y_n = 200
>>> chromatic_adaptation_Fairchild1990(XYZ_1, XYZ_n, XYZ_r, Y_n)    
array([ 23.3252634...,  23.3245581...,  76.1159375...])
colour.adaptation.fairchild1990.XYZ_to_RGB_fairchild1990(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([19.53, 23.07, 24.97])
>>> XYZ_to_RGB_fairchild1990(XYZ)  
array([ 22.1231935...,  23.6054224...,  22.9279534...])
colour.adaptation.fairchild1990.RGB_to_XYZ_fairchild1990(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([22.1231935, 23.6054224, 22.9279534])
>>> RGB_to_XYZ_fairchild1990(RGB)  
array([ 19.53,  23.07,  24.97])
colour.adaptation.fairchild1990.degrees_of_adaptation(LMS, Y_n, v=0.3333333333333333, discount_illuminant=False)[source]

Computes the degrees of adaptation \(p_L\), \(p_M\) and \(p_S\).

Parameters:
  • LMS (array_like, (3,)) – Cone responses.
  • Y_n (numeric) – Luminance \(Y_n\) of test adapting stimulus in \(cd/m^2\).
  • v (numeric, optional) – Exponent \(v\).
  • discount_illuminant (bool, optional) – Truth value indicating if the illuminant should be discounted.
Returns:

Degrees of adaptation \(p_L\), \(p_M\) and \(p_S\).

Return type:

ndarray, (3,)

Examples

>>> LMS = np.array([20.0005206, 19.999783, 19.9988316])
>>> Y_n = 31.83
>>> degrees_of_adaptation(LMS, Y_n)  
array([ 0.9799324...,  0.9960035...,  1.0233041...])
>>> degrees_of_adaptation(LMS, Y_n, 1 / 3, True)
array([1, 1, 1])