colour.chromatic_adaptation¶
-
colour.
chromatic_adaptation
(XYZ, XYZ_w, XYZ_wr, method='Von Kries', **kwargs)[source]¶ Adapts given stimulus from test viewing conditions to reference viewing conditions.
Parameters: - XYZ (array_like) – CIE XYZ tristimulus values of stimulus to adapt.
- XYZ_w (array_like) – Test viewing condition CIE XYZ tristimulus values of the whitepoint.
- XYZ_wr (array_like) – Reference viewing condition CIE XYZ tristimulus values of the whitepoint.
- method (unicode, optional) – {‘Von Kries’, ‘CIE 1994’, ‘CMCCAT2000’, ‘Fairchild 1990’}, Computation method.
Other Parameters: - E_o1 (numeric) – {
colour.adaptation.chromatic_adaptation_CIE1994()
}, Test illuminance \(E_{o1}\) in \(cd/m^2\). - E_o2 (numeric) – {
colour.adaptation.chromatic_adaptation_CIE1994()
}, Reference illuminance \(E_{o2}\) in \(cd/m^2\). - L_A1 (numeric or array_like) – {
colour.adaptation.chromatic_adaptation_CMCCAT2000()
}, Luminance of test adapting field \(L_{A1}\) in \(cd/m^2\). - L_A2 (numeric or array_like) – {
colour.adaptation.chromatic_adaptation_CMCCAT2000()
}, Luminance of reference adapting field \(L_{A2}\) in \(cd/m^2\). - Y_n (numeric or array_like) – {
colour.adaptation.chromatic_adaptation_Fairchild1990()
}, Luminance \(Y_n\) of test adapting stimulus in \(cd/m^2\). - Y_o (numeric) – {
colour.adaptation.chromatic_adaptation_CIE1994()
}, Luminance factor \(Y_o\) of achromatic background normalised to domain [0.18, 1] in ‘Reference’ domain-range scale. - direction (unicode, optional) – {
colour.adaptation.chromatic_adaptation_CMCCAT2000()
}, {‘Forward’, ‘Reverse’}, Chromatic adaptation direction. - discount_illuminant (bool, optional) – {
colour.adaptation.chromatic_adaptation_Fairchild1990()
}, Truth value indicating if the illuminant should be discounted. - n (numeric, optional) – {
colour.adaptation.chromatic_adaptation_CIE1994()
}, Noise component in fundamental primary system. - surround (CMCCAT2000_InductionFactors, optional) – {
colour.adaptation.chromatic_adaptation_CMCCAT2000()
}, Surround viewing conditions induction factors. - transform (unicode, optional) – {
colour.adaptation.chromatic_adaptation_VonKries()
}, {‘CAT02’, ‘XYZ Scaling’, ‘Von Kries’, ‘Bradford’, ‘Sharp’, ‘Fairchild’, ‘CMCCAT97’, ‘CMCCAT2000’, ‘CAT02_BRILL_CAT’, ‘Bianco’, ‘Bianco PC’}, Chromatic adaptation transform.
Returns: CIE XYZ_c tristimulus values of the stimulus corresponding colour.
Return type: ndarray
Notes
Domain Scale - Reference Scale - 1 XYZ
[0, 1] [0, 1] XYZ_w
[0, 1] [0, 1] XYZ_wr
[0, 1] [0, 1] Y_o
[0, 1] [0, 1] Range Scale - Reference Scale - 1 XYZ_c
[0, 1] [0, 1] References
[CIET13294], [Fai91], [Fai13c], [Fai13b], [LLRH02], [WRC12a]
Examples
Von Kries chromatic adaptation:
>>> import numpy as np >>> XYZ = np.array([0.20654008, 0.12197225, 0.05136952]) >>> XYZ_w = np.array([0.95045593, 1.00000000, 1.08905775]) >>> XYZ_wr = np.array([0.96429568, 1.00000000, 0.82510460]) >>> chromatic_adaptation(XYZ, XYZ_w, XYZ_wr) ... # doctest: +ELLIPSIS array([ 0.2163881..., 0.1257 , 0.0384749...])
CIE 1994 chromatic adaptation, requires extra kwargs:
>>> XYZ = np.array([0.2800, 0.2126, 0.0527]) >>> XYZ_w = np.array([1.09867452, 1.00000000, 0.35591556]) >>> XYZ_wr = np.array([0.95045593, 1.00000000, 1.08905775]) >>> Y_o = 0.20 >>> E_o = 1000 >>> chromatic_adaptation( ... XYZ, XYZ_w, XYZ_wr, method='CIE 1994', Y_o=Y_o, E_o1=E_o, E_o2=E_o) ... # doctest: +ELLIPSIS array([ 0.2403379..., 0.2115621..., 0.1764301...])
CMCCAT2000 chromatic adaptation, requires extra kwargs:
>>> XYZ = np.array([0.2248, 0.2274, 0.0854]) >>> XYZ_w = np.array([1.1115, 1.0000, 0.3520]) >>> XYZ_wr = np.array([0.9481, 1.0000, 1.0730]) >>> L_A = 200 >>> chromatic_adaptation( ... XYZ, XYZ_w, XYZ_wr, method='CMCCAT2000', L_A1=L_A, L_A2=L_A) ... # doctest: +ELLIPSIS array([ 0.1952698..., 0.2306834..., 0.2497175...])
Fairchild (1990) chromatic adaptation, requires extra kwargs:
>>> XYZ = np.array([0.1953, 0.2307, 0.2497]) >>> Y_n = 200 >>> chromatic_adaptation( ... XYZ, XYZ_w, XYZ_wr, method='Fairchild 1990', Y_n=Y_n) ... # doctest: +ELLIPSIS array([ 0.2332526..., 0.2332455..., 0.7611593...])