color v0.1.0 Color
Summary
Functions
The Delta E (CIE94) algorithm http://en.wikipedia.org/wiki/Color_difference#CIE94
There is a newer version, CIEDE2000, that uses slightly more complicated math, but addresses “the perceptual uniformity issue” left lingering by the CIE94 algorithm. color_1 and color_2 are both Lab* maps, rendered by hex_to_lab/1.
Since our source is treated as sRGB, we use the “graphic arts” presets for k_L, k_1, and k_2
The calculations go through LCH(ab).
delta_E = :math.sqrt( ((delta_L / (k_L s_L)) ** 2) + ((delta_C / (k_C s_C)) 2) + ((delta_H / (k_H * s_H)) 2) )
Under some circumstances in real computers, delta_H could be an imaginary number (it’s a square root value), so we’re going to treat this as:
delta_E = :math.sqrt( ((delta_L / (k_L s_L)) ** 2) + ((delta_C / (k_C s_C)) 2) + (delta_H2 / ((k_H * s_H) 2))) )
And not perform the square root when calculating delta_H2.
See also http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CIE94.html