colour.difference.delta_e Module

\(\Delta E_{ab}\) - Delta E Colour Difference

Defines \(\Delta E_{ab}\) colour difference computation objects:

The following methods are available:

References

[1]http://en.wikipedia.org/wiki/Color_difference (Last accessed 29 August 2014)
colour.difference.delta_e.delta_E_CIE_1976(lab1, lab2, **kwargs)[source]

Returns the difference \(\Delta E_{ab}\) between two given CIE Lab array_like colours using CIE 1976 recommendation.

Parameters:
  • lab1 (array_like, (3,)) – CIE Lab array_like colour 1.
  • lab2 (array_like, (3,)) – CIE Lab array_like colour 2.
  • **kwargs (**, optional) – Unused parameter provided for signature compatibility with other \(\Delta E_{ab}\) computation objects.
Returns:

Colour difference \(\Delta E_{ab}\).

Return type:

numeric

References

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

Examples

>>> lab1 = np.array([100, 21.57210357, 272.2281935])
>>> lab2 = np.array([100, 426.67945353, 72.39590835])
>>> delta_E_CIE_1976(lab1, lab2)  
451.7133019...
colour.difference.delta_e.delta_E_CIE_1994(lab1, lab2, textiles=True, **kwargs)[source]

Returns the difference \(\Delta E_{ab}\) between two given CIE Lab array_like colours using CIE 1994 recommendation.

Parameters:
  • lab1 (array_like, (3,)) – CIE Lab array_like colour 1.
  • lab2 (array_like, (3,)) – CIE Lab array_like colour 2.
  • textiles (bool, optional) – Application specific weights.
  • **kwargs (**, optional) – Unused parameter provided for signature compatibility with other \(\Delta E_{ab}\) computation objects.
Returns:

Colour difference \(\Delta E_{ab}\).

Return type:

numeric

References

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

Examples

>>> lab1 = np.array([100, 21.57210357, 272.2281935])
>>> lab2 = np.array([100, 426.67945353, 72.39590835])
>>> delta_E_CIE_1994(lab1, lab2)  
88.3355530...
>>> delta_E_CIE_1994(lab1, lab2, textiles=False)  
83.7792255...
colour.difference.delta_e.delta_E_CIE_2000(lab1, lab2, **kwargs)[source]

Returns the difference \(\Delta E_{ab}\) between two given CIE Lab array_like colours using CIE 2000 recommendation.

Parameters:
  • lab1 (array_like, (3,)) – CIE Lab array_like colour 1.
  • lab2 (array_like, (3,)) – CIE Lab array_like colour 2.
  • **kwargs (**, optional) – Unused parameter provided for signature compatibility with other \(\Delta E_{ab}\) computation objects.
Returns:

Colour difference \(\Delta E_{ab}\).

Return type:

numeric

References

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

Examples

>>> lab1 = np.array([100, 21.57210357, 272.2281935])
>>> lab2 = np.array([100, 426.67945353, 72.39590835])
>>> delta_E_CIE_2000(lab1, lab2)  
94.0356490...
colour.difference.delta_e.delta_E_CMC(lab1, lab2, l=2, c=1)[source]

Returns the difference \(\Delta E_{ab}\) between two given CIE Lab array_like colours using Colour Measurement Committee recommendation.

The quasimetric has two parameters: Lightness (l) and chroma (c), allowing the users to weight the difference based on the ratio of l:c. Commonly used values are 2:1 for acceptability and 1:1 for the threshold of imperceptibility.

Parameters:
  • lab1 (array_like, (3,)) – CIE Lab array_like colour 1.
  • lab2 (array_like, (3,)) – CIE Lab array_like colour 2.
  • l (numeric, optional) – Lightness weighting factor.
  • c (numeric, optional) – Chroma weighting factor.
Returns:

Colour difference \(\Delta E_{ab}\).

Return type:

numeric

References

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

Examples

>>> lab1 = np.array([100, 21.57210357, 272.2281935])
>>> lab2 = np.array([100, 426.67945353, 72.39590835])
>>> delta_E_CMC(lab1, lab2)  
172.7047712...
colour.difference.delta_e.DELTA_E_METHODS = {u'cie1994': <function delta_E_CIE_1994 at 0x102e4a938>, u'CIE 1994': <function delta_E_CIE_1994 at 0x102e4a938>, u'cie1976': <function delta_E_CIE_1976 at 0x102e4a8c0>, u'CMC': <function delta_E_CMC at 0x102e4aa28>, u'CIE 1976': <function delta_E_CIE_1976 at 0x102e4a8c0>, u'cie2000': <function delta_E_CIE_2000 at 0x102e4a9b0>, u'CIE 2000': <function delta_E_CIE_2000 at 0x102e4a9b0>}

Supported Delta E computations methods.

DELTA_E_METHODS : dict
(‘CIE 1976’, ‘CIE 1994’, ‘CIE 2000’, ‘CMC’)

Aliases:

  • ‘cie1976’: ‘CIE 1976’
  • ‘cie1994’: ‘CIE 1994’
  • ‘cie2000’: ‘CIE 2000’
colour.difference.delta_e.delta_E(lab1, lab2, method=u'CMC', **kwargs)[source]

Returns the Lightness \(L^*\) using given method.

Parameters:
  • lab1 (array_like, (3,)) – CIE Lab array_like colour 1.
  • lab2 (array_like, (3,)) – CIE Lab array_like colour 2.
  • method (unicode, optional) – (‘CIE 1976’, ‘CIE 1994’, ‘CIE 2000’, ‘CMC’) Computation method.
  • **kwargs (**) – Keywords arguments.
Returns:

Colour difference \(\Delta E_{ab}\).

Return type:

numeric

Examples

>>> lab1 = np.array([100, 21.57210357, 272.2281935])
>>> lab2 = np.array([100, 426.67945353, 72.39590835])
>>> delta_E(lab1, lab2)  
172.7047712...
>>> delta_E(lab1, lab2, method='CIE 1976')  
451.7133019...
>>> delta_E(lab1, lab2, method='CIE 1994')  
88.3355530...
>>> delta_E(lab1, lab2, method='CIE 1994', textiles=False)    
83.7792255...
>>> delta_E(lab1, lab2, method='CIE 2000')  
94.0356490...