Delta E (CIE 1994)

The color difference, or ΔE, between a sample color L2a2b2 and a reference color L1a1b1 is:

Equation 1

where

Equation 2

Implementation Notes:

  1. In the calculation of ΔH, the value inside the radical is, in theory, always greater than or equal to zero. However in an actual implementation, it may become a very slightly negative value, due to limited arithmetic precision. Should this occur, the square root will fail. Be sure to account for this possibility (see following note for a solution).
  2. The value for ΔH is not actually needed. Rather, ΔH2 is needed instead. So an optimization might be to avoid the square root altogether.