colour.difference Package

Module Contents

colour.difference.delta_E(Lab_1, Lab_2, method=u'CMC', **kwargs)[source]

Returns the difference \(\Delta E_{ab}\) between two given CIE Lab colourspace arrays using given method.

Parameters:
  • Lab_1 (array_like) – CIE Lab colourspace array 1.
  • Lab_2 (array_like) – CIE Lab colourspace array 2.
  • method (unicode, optional) – {‘CMC’, ‘CIE 1976’, ‘CIE 1994’, ‘CIE 2000’}, Computation method.
Other Parameters:
 
  • textiles (bool, optional) – {delta_E_CIE1994(), delta_E_CIE2000()}, Textiles application specific parametric factors \(k_L=2,\ k_C=k_H=1,\ k_1=0.048,\ k_2=0.014\) weights are used instead of \(k_L=k_C=k_H=1,\ k_1=0.045,\ k_2=0.015\).
  • l (numeric, optional) – {delta_E_CIE2000()}, Lightness weighting factor.
  • c (numeric, optional) – {delta_E_CIE2000()}, Chroma weighting factor.
Returns:

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

Return type:

numeric or ndarray

Examples

>>> Lab_1 = np.array([100.00000000, 21.57210357, 272.22819350])
>>> Lab_2 = np.array([100.00000000, 426.67945353, 72.39590835])
>>> delta_E(Lab_1, Lab_2)  
172.7047712...
>>> delta_E(Lab_1, Lab_2, method='CIE 1976')  
451.7133019...
>>> delta_E(Lab_1, Lab_2, method='CIE 1994')  
83.7792255...
>>> delta_E(  
...     Lab_1, Lab_2, method='CIE 1994', textiles=False)
83.7792255...
>>> delta_E(Lab_1, Lab_2, method='CIE 2000')  
94.0356490...
colour.difference.delta_E_CIE1976(Lab_1, Lab_2)[source]

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

Parameters:
  • Lab_1 (array_like) – CIE Lab colourspace array 1.
  • Lab_2 (array_like) – CIE Lab colourspace array 2.
Returns:

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

Return type:

numeric or ndarray

References

[2]Lindbloom, B. (2003). Delta E (CIE 1976). Retrieved February 24, 2014, from http://brucelindbloom.com/Eqn_DeltaE_CIE76.html

Examples

>>> Lab_1 = np.array([100.00000000, 21.57210357, 272.22819350])
>>> Lab_2 = np.array([100.00000000, 426.67945353, 72.39590835])
>>> delta_E_CIE1976(Lab_1, Lab_2)  
451.7133019...
colour.difference.delta_E_CIE1994(Lab_1, Lab_2, textiles=False)[source]

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

Parameters:
  • Lab_1 (array_like) – CIE Lab colourspace array 1.
  • Lab_2 (array_like) – CIE Lab colourspace array 2.
  • textiles (bool, optional) – Textiles application specific parametric factors \(k_L=2,\ k_C=k_H=1,\ k_1=0.048,\ k_2=0.014\) weights are used instead of \(k_L=k_C=k_H=1,\ k_1=0.045,\ k_2=0.015\).
Returns:

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

Return type:

numeric or ndarray

Notes

  • CIE 1994 colour differences are not symmetrical: difference between Lab_1 and Lab_2 may not be the same as difference between Lab_2 and Lab_1 thus one colour must be understood to be the reference against which a sample colour is compared.

References

[3]Lindbloom, B. (2011). Delta E (CIE 1994). Retrieved February 24, 2014, from http://brucelindbloom.com/Eqn_DeltaE_CIE94.html

Examples

>>> Lab_1 = np.array([100.00000000, 21.57210357, 272.22819350])
>>> Lab_2 = np.array([100.00000000, 426.67945353, 72.39590835])
>>> delta_E_CIE1994(Lab_1, Lab_2)  
83.7792255...
>>> delta_E_CIE1994(Lab_1, Lab_2, textiles=True)  
88.3355530...
colour.difference.delta_E_CIE2000(Lab_1, Lab_2, textiles=False)[source]

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

Parameters:
  • Lab_1 (array_like) – CIE Lab colourspace array 1.
  • Lab_2 (array_like) – CIE Lab colourspace array 2.
  • textiles (bool, optional) – Textiles application specific parametric factors \(k_L=2,\ k_C=k_H=1\) weights are used instead of \(k_L=k_C=k_H=1\).
Returns:

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

Return type:

numeric or ndarray

Notes

  • CIE 2000 colour differences are not symmetrical: difference between Lab_1 and Lab_2 may not be the same as difference between Lab_2 and Lab_1 thus one colour must be understood to be the reference against which a sample colour is compared.
  • Parametric factors \(k_L=k_C=k_H=1\) weights under reference conditions: [5]_
    • Illumination: D65 source
    • Illuminance: 1000 lx
    • Observer: Normal colour vision
    • Background field: Uniform, neutral gray with \(L^*=50\)
    • Viewing mode: Object
    • Sample size: Greater than 4 degrees
    • Sample separation: Direct edge contact
    • Sample colour-difference magnitude: Lower than 5.0 \(\Delta E_{ab}\)
    • Sample structure: Homogeneous (without texture)

References

[4]Lindbloom, B. (2009). Delta E (CIE 2000). Retrieved February 24, 2014, from http://brucelindbloom.com/Eqn_DeltaE_CIE2000.html
[5]Melgosa, M. (2013). CIE / ISO new standard: CIEDE2000, 2013(July). Retrieved from http://www.color.org/events/colorimetry/Melgosa_CIEDE2000_Workshop-July4.pdf

Examples

>>> Lab_1 = np.array([100.00000000, 21.57210357, 272.22819350])
>>> Lab_2 = np.array([100.00000000, 426.67945353, 72.39590835])
>>> delta_E_CIE2000(Lab_1, Lab_2)  
94.0356490...
>>> Lab_2 = np.array([50.00000000, 426.67945353, 72.39590835])
>>> delta_E_CIE2000(Lab_1, Lab_2)  
100.8779470...
>>> delta_E_CIE2000(Lab_1, Lab_2, textiles=True)  
95.7920535...
colour.difference.delta_E_CMC(Lab_1, Lab_2, l=2, c=1)[source]

Returns the difference \(\Delta E_{ab}\) between two given CIE Lab colourspace arrays 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:
  • Lab_1 (array_like) – CIE Lab colourspace array 1.
  • Lab_2 (array_like) – CIE Lab colourspace array 2.
  • l (numeric, optional) – Lightness weighting factor.
  • c (numeric, optional) – Chroma weighting factor.
Returns:

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

Return type:

numeric or ndarray

References

[5]Lindbloom, B. (2009). Delta E (CMC). Retrieved February 24, 2014, from http://brucelindbloom.com/Eqn_DeltaE_CMC.html

Examples

>>> Lab_1 = np.array([100.00000000, 21.57210357, 272.22819350])
>>> Lab_2 = np.array([100.00000000, 426.67945353, 72.39590835])
>>> delta_E_CMC(Lab_1, Lab_2)  
172.7047712...
colour.difference.delta_E_CAM02LCD(Jpapbp_1, Jpapbp_2)[source]

Returns the difference \(\Delta E'\) between two given Luo et al. (2006) CAM02-LCD colourspaces \(J'a'b'\) arrays.

Parameters:
  • Jpapbp_1 (array_like) – Standard / reference Luo et al. (2006) CAM02-LCD colourspaces \(J'a'b'\) array.
  • Jpapbp_2 (array_like) – Sample / test Luo et al. (2006) CAM02-LCD colourspaces \(J'a'b'\) array.
Returns:

Colour difference \(\Delta E'\).

Return type:

numeric or ndarray

Examples

>>> Jpapbp_1 = np.array([54.90433134, -0.08450395, -0.06854831])
>>> Jpapbp_2 = np.array([54.90433134, -0.08442362, -0.06848314])
>>> delta_E_CAM02LCD(Jpapbp_1, Jpapbp_2)  
0.0001034...
colour.difference.delta_E_CAM02SCD(Jpapbp_1, Jpapbp_2)[source]

Returns the difference \(\Delta E'\) between two given Luo et al. (2006) CAM02-SCD colourspaces \(J'a'b'\) arrays.

Parameters:
  • Jpapbp_1 (array_like) – Standard / reference Luo et al. (2006) CAM02-SCD colourspaces \(J'a'b'\) array.
  • Jpapbp_2 (array_like) – Sample / test Luo et al. (2006) CAM02-SCD colourspaces \(J'a'b'\) array.
Returns:

Colour difference \(\Delta E'\).

Return type:

numeric or ndarray

Examples

>>> Jpapbp_1 = np.array([54.90433134, -0.08450395, -0.06854831])
>>> Jpapbp_2 = np.array([54.90433134, -0.08442362, -0.06848314])
>>> delta_E_CAM02SCD(Jpapbp_1, Jpapbp_2)  
0.0001034...
colour.difference.delta_E_CAM02UCS(Jpapbp_1, Jpapbp_2)[source]

Returns the difference \(\Delta E'\) between two given Luo et al. (2006) CAM02-UCS colourspaces \(J'a'b'\) arrays.

Parameters:
  • Jpapbp_1 (array_like) – Standard / reference Luo et al. (2006) CAM02-UCS colourspaces \(J'a'b'\) array.
  • Jpapbp_2 (array_like) – Sample / test Luo et al. (2006) CAM02-UCS colourspaces \(J'a'b'\) array.
Returns:

Colour difference \(\Delta E'\).

Return type:

numeric or ndarray

Examples

>>> Jpapbp_1 = np.array([54.90433134, -0.08450395, -0.06854831])
>>> Jpapbp_2 = np.array([54.90433134, -0.08442362, -0.06848314])
>>> delta_E_CAM02UCS(Jpapbp_1, Jpapbp_2)  
0.0001034...