colour.difference Package

Module Contents

colour.difference.delta_E(Lab1, Lab2, method=u'CMC', **kwargs)

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) – {‘CMC’, ‘CIE 1976’, ‘CIE 1994’, ‘CIE 2000’} 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...
colour.difference.delta_E_CIE1976(Lab1, Lab2, **kwargs)

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]Lindbloom, B. (2003). Delta E (CIE 1976). Retrieved February 24, 2014, from http://brucelindbloom.com/Eqn_DeltaE_CIE76.html

Examples

>>> Lab1 = np.array([100, 21.57210357, 272.2281935])
>>> Lab2 = np.array([100, 426.67945353, 72.39590835])
>>> delta_E_CIE1976(Lab1, Lab2)  
451.7133019...
colour.difference.delta_E_CIE1994(Lab1, Lab2, textiles=True, **kwargs)

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]Lindbloom, B. (2011). Delta E (CIE 1994). Retrieved February 24, 2014, from http://brucelindbloom.com/Eqn_DeltaE_CIE94.html

Examples

>>> Lab1 = np.array([100, 21.57210357, 272.2281935])
>>> Lab2 = np.array([100, 426.67945353, 72.39590835])
>>> delta_E_CIE1994(Lab1, Lab2)  
88.3355530...
>>> delta_E_CIE1994(Lab1, Lab2, textiles=False)  
83.7792255...
colour.difference.delta_E_CIE2000(Lab1, Lab2, **kwargs)

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]Lindbloom, B. (2009). Delta E (CIE 2000). Retrieved February 24, 2014, from http://brucelindbloom.com/Eqn_DeltaE_CIE2000.html

Examples

>>> Lab1 = np.array([100, 21.57210357, 272.2281935])
>>> Lab2 = np.array([100, 426.67945353, 72.39590835])
>>> delta_E_CIE2000(Lab1, Lab2)  
94.0356490...
colour.difference.delta_E_CMC(Lab1, Lab2, l=2, c=1)

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]Lindbloom, B. (2009). Delta E (CMC). Retrieved February 24, 2014, from http://brucelindbloom.com/Eqn_DeltaE_CMC.html

Examples

>>> Lab1 = np.array([100, 21.57210357, 272.2281935])
>>> Lab2 = np.array([100, 426.67945353, 72.39590835])
>>> delta_E_CMC(Lab1, Lab2)  
172.7047712...