colour.adaptation Package

Module Contents

colour.adaptation.chromatic_adaptation_matrix(XYZ1, XYZ2, method=u'CAT02')

Returns the chromatic adaptation matrix from given source and target CIE XYZ colourspace array_like variables.

Parameters:
  • XYZ1 (array_like, (3,)) – CIE XYZ source array_like variable.
  • XYZ2 (array_like, (3,)) – CIE XYZ target array_like variable.
  • method (unicode, optional) – (‘XYZ Scaling’, ‘Bradford’, ‘Von Kries’, ‘Fairchild, ‘CAT02’), Chromatic adaptation method.
Returns:

Chromatic adaptation matrix.

Return type:

ndarray, (3, 3)

Raises:

KeyError – If chromatic adaptation method is not defined.

References

[4]http://brucelindbloom.com/Eqn_ChromAdapt.html (Last accessed 24 February 2014)

Examples

>>> XYZ1 = np.array([1.09923822, 1.000, 0.35445412])
>>> XYZ2 = np.array([0.96907232, 1.000, 1.121792157])
>>> chromatic_adaptation_matrix(XYZ1, XYZ2)  
array([[ 0.8714561..., -0.1320467...,  0.4039483...],
       [-0.0963880...,  1.0490978...,  0.160403... ],
       [ 0.0080207...,  0.0282636...,  3.0602319...]])

Using Bradford method:

>>> XYZ1 = np.array([1.09923822, 1.000, 0.35445412])
>>> XYZ2 = np.array([0.96907232, 1.000, 1.121792157])
>>> method = 'Bradford'
>>> chromatic_adaptation_matrix(XYZ1, XYZ2, method)  
array([[ 0.8518131..., -0.1134786...,  0.4124804...],
       [-0.1277659...,  1.0928930...,  0.1341559...],
       [ 0.0845323..., -0.1434969...,  3.3075309...]])