Closed matkoniecz closed 9 years ago
I don’t know with absolute certainty, but I think that this is (unfortunately) the way that the math works out. Most colour math is an approximation, not something that guarantees transitivity.
For colour 2.x, I’m going to be moving as much as possible to matrix math, but I haven’t had a chance to get as familiar with the math involved as I should be before embarking on a rewrite. This may not make things any better.
See the name of the algorithm and the reference mentioned in the comment: https://en.wikipedia.org/wiki/Color_difference#CIE94. I've checked implementation and found no differences with Wikipedia.
It's not a bug, but a known property of Delta-E 94 algorithm. See e.g. http://mathematica.stackexchange.com/questions/86730/is-colordistance-symmetric. I believe that quote from here about CMC algorithm can be applied to CIE 94 as well:
the formula is not symmetric, but depends on a standard and a test colour.
Switching standard and test colors changes the difference.
Thanks! Sorry for spurious bug report.
I would expect
to print the same value twice (as distance between colour is the same in both cases as colours are the same). Bur result is
I found one suspicious fragment of code -
in https://github.com/halostatue/color/blob/master/lib/color/rgb.rb#L432 that seems to break symmetry between the first and the second color.
But changing second c_1 to c_2 is not fixing lack of symmetry (though in general difference is reduced) - result is