Class ColorDifference
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:- Sharma G, Wu W, Dalal EN.The CIEDE2000 Color-Difference Formula: Implementation Notes, Supplementary Test Data and Mathematical Observations. 2004.
- Mokrzycki WS, Tatol M. Colour difference delta E - A survey
- brucelindbloom.com
- Wikipedia
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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)
-
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
- color1lab2
- 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
- color1lab2
- color2KL
- depend on application: graphics arts = 1, textiles = 2KC
- usually = 1KH
- usually = 1K1
- depend on application: graphics arts = 0.045, textiles = 0.048K2
- 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
- color1lab2
- 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
- color1lab2
- 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
- color1lab2
- color2lightness
- 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:1l range 0:100
a range -128:+128
b range -128:+128
- Parameters:
lab1
- color1lab2
- color2- Returns:
- color distance (>=0)
-
deltaECMC
public static double deltaECMC(double l1, double a1, double b1, double l2, double a2, double b2)
-