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 tristimulus values 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 tristimulus values 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 stimulus CIE XYZ_1 tristimulus values from test viewing conditions to reference viewing conditions using Fairchild (1990) chromatic adaptation model.

Parameters:
  • XYZ_1 (array_like) – CIE XYZ_1 tristimulus values of test sample / stimulus in domain [0, 100].
  • XYZ_n (array_like) – Test viewing condition CIE XYZ_n tristimulus values of whitepoint.
  • XYZ_r (array_like) – Reference viewing condition CIE XYZ_r tristimulus values of whitepoint.
  • Y_n (numeric or array_like) – 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 tristimulus values of stimulus.

Return type:

ndarray

Warning

The input domain of that definition is non standard!

Notes

  • Input CIE XYZ_1, CIE XYZ_n and CIE XYZ_r tristimulus values are in domain [0, 100].
  • Output CIE XYZ_2 tristimulus values are 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 tristimulus values to cone responses.

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

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 tristimulus values.

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

Examples

>>> RGB = np.array([22.12319350, 23.60542240, 22.92795340])
>>> 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) – Cone responses.
  • Y_n (numeric or array_like) – Luminance \(Y_n\) of test adapting stimulus in \(cd/m^2\).
  • v (numeric or array_like, 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

Examples

>>> LMS = np.array([20.00052060, 19.99978300, 19.99883160])
>>> 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.])