Class ColorDifference

java.lang.Object
boofcv.alg.color.ColorDifference

public class ColorDifference extends Object

Methods for computing the difference (or error) between two colors in CIELAB color space

Colour difference deltaE: difference between two colors is a metric that allow quantified examination of a notion of color similarity. These methods uses Lab color space. Color distance is a positive value, and lower values means better match. Scale changes with used method "The observed difference in the color (perceptual difference) is a psychophysical difference noticeable by the observer, determined by the actual observation of two samples. The calculated difference in the color depends on the color model. Because the color stimulus can be represented as a point in space, the difference in color ∆E between two stimuli is calculated as the distance between the points representing these stimuli." [2] The best source for color difference is [3]. I believe it is the most correct implementation I've found. Usually different sources shows different results, especially for CIEDE2000. [1] is used to implement CIEDE2000. [3] used to implement other methods. [2] is a source of comparative data for RGB delta difference, although some results are still little different (second decimal place) and I could not found the source of error. [4] is also a good source of information. Equation from:
  1. Sharma G, Wu W, Dalal EN.The CIEDE2000 Color-Difference Formula: Implementation Notes, Supplementary Test Data and Mathematical Observations. 2004.
  2. Mokrzycki WS, Tatol M. Colour difference delta E - A survey
  3. brucelindbloom.com
  4. Wikipedia
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    deltaECIE76(double[] lab1, double[] lab2)
    CIE76 simple color difference equation in CIELAB color space.
    static double
    deltaECIE76(double l1, double a1, double b1, double l2, double a2, double b2)
     
    static double
    deltaECIE94(double[] lab1, double[] lab2)
    CIE94 color difference equation.
    static double
    deltaECIE94(double[] lab1, double[] lab2, double KL, double KC, double KH, double K1, double K2)
    CIE94 color difference equation.
    static double
    deltaECIE94(double l1, double a1, double b1, double l2, double a2, double b2)
     
    static double
    deltaECIE94(double l1, double a1, double b1, double l2, double a2, double b2, double KL, double KC, double KH, double K1, double K2)
     
    static double
    deltaECIEDE2000(double[] lab1, double[] lab2)
    CIEDE2000 color difference equation.
    static double
    deltaECIEDE2000(double l1, double a1, double b1, double l2, double a2, double b2)
     
    static double
    deltaECMC(double[] lab1, double[] lab2)
    CMC l:c color difference equation defined by Colour Measurement Committee of the Society of Dyers and Colourist.
    static double
    deltaECMC(double[] lab1, double[] lab2, double lightness, double chroma)
    CMC l:c color difference equation defined by Colour Measurement Committee of the Society of Dyers and Colourist.
    static double
    deltaECMC(double l1, double a1, double b1, double l2, double a2, double b2)
     
    static double
    deltaECMC(double l1, double a1, double b1, double l2, double a2, double b2, double lightness, double chroma)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ColorDifference

      public ColorDifference()
  • Method Details

    • deltaECIE76

      public static double deltaECIE76(double[] lab1, double[] lab2)

      CIE76 simple color difference equation in CIELAB color space. Calculate distance between color1 and color2 close to human perception.

      l range 0:100
      a range -128:+128
      b range -128:+128

      Parameters:
      lab1 - color1
      lab2 - color2
      Returns:
      colors distance (>=0)
    • deltaECIE76

      public static double deltaECIE76(double l1, double a1, double b1, double l2, double a2, double b2)
    • deltaECIE94

      public static double deltaECIE94(double[] lab1, double[] lab2, double KL, double KC, double KH, double K1, double K2)

      CIE94 color difference equation. This is the an extended CIE76 to address perceptual non-uniformities in CIELAB color space.

      l range 0:100
      a range -128:+128
      b range -128:+128

      Parameters:
      lab1 - color1
      lab2 - color2
      KL - depend on application: graphics arts = 1, textiles = 2
      KC - usually = 1
      KH - usually = 1
      K1 - depend on application: graphics arts = 0.045, textiles = 0.048
      K2 - depend on application: graphics arts = 0.015, textiles = 0.014
      Returns:
      colors distance (>=0)
    • deltaECIE94

      public static double deltaECIE94(double l1, double a1, double b1, double l2, double a2, double b2, double KL, double KC, double KH, double K1, double K2)
    • deltaECIE94

      public static double deltaECIE94(double[] lab1, double[] lab2)

      CIE94 color difference equation. CIE94 with reasonably parameters (graphics arts). In doubt, use this one!!

      l range 0:100
      a range -128:+128
      b range -128:+128

      Parameters:
      lab1 - color1
      lab2 - color2
      Returns:
      colors distance (>=0)
    • deltaECIE94

      public static double deltaECIE94(double l1, double a1, double b1, double l2, double a2, double b2)
    • deltaECIEDE2000

      public static double deltaECIEDE2000(double[] lab1, double[] lab2)

      CIEDE2000 color difference equation.

      Super crazy color difference equation. Extends the CIE94 to a very nerdy level. Should be better than CIE94, but more expensive and should make no difference in practical applications according to [Color Apperance Models, Mark D Fairchild]

      l range 0:100
      a range -128:+128
      b range -128:+128

      Parameters:
      lab1 - color1
      lab2 - color2
      Returns:
      color distance (>=0)
    • deltaECIEDE2000

      public static double deltaECIEDE2000(double l1, double a1, double b1, double l2, double a2, double b2)
    • deltaECMC

      public static double deltaECMC(double[] lab1, double[] lab2, double lightness, double chroma)
      CMC l:c color difference equation defined by Colour Measurement Committee of the Society of Dyers and Colourist.

      Commonly used values are 2:1 (l=2,c=1) for acceptability and 1:1 (l=1,c=1) for the threshold of imperceptibility.

      l range 0:100
      a range -128:+128
      b range -128:+128

      Parameters:
      lab1 - color1
      lab2 - color2
      lightness - lightness.
      chroma - chroma.
      Returns:
      color distance (>=0)
    • deltaECMC

      public static double deltaECMC(double l1, double a1, double b1, double l2, double a2, double b2, double lightness, double chroma)
    • deltaECMC

      public static double deltaECMC(double[] lab1, double[] lab2)

      CMC l:c color difference equation defined by Colour Measurement Committee of the Society of Dyers and Colourist.

      Default to l:c = 1:1

      l range 0:100
      a range -128:+128
      b range -128:+128

      Parameters:
      lab1 - color1
      lab2 - color2
      Returns:
      color distance (>=0)
    • deltaECMC

      public static double deltaECMC(double l1, double a1, double b1, double l2, double a2, double b2)