JuliaGraphics / Colors.jl

Color manipulation utilities for Julia
Other
202 stars 47 forks source link

Non-standard implementation of `DE_CMC` and `DE_94` #438

Closed kimikage closed 3 years ago

kimikage commented 4 years ago

The CMC(l:c) color difference model quantifies the difference from a standard (reference) color. https://en.wikipedia.org/wiki/Color_difference#CMC_l:c_(1984)

However, the current implementation uses the mean value as the "standard" rather than one of the colordiff inputs. https://github.com/JuliaGraphics/Colors.jl/blob/efdb8a569e1607517e986fa01a51f6e41ab9cbd0/src/differences.jl#L328-L329 The comment implies that it is intentional rather than a mistake, but the averaging is not the original method. Even if we were to follow the method of using the mean values, the following uses a.l instead of ml, which is not consistent. https://github.com/JuliaGraphics/Colors.jl/blob/efdb8a569e1607517e986fa01a51f6e41ab9cbd0/src/differences.jl#L338-L343

Although CMC (l:c) is an old model, it appears to still be used in the textile industry, as it is included in the ISO 105-J03 standard.

In practice, there seems to be a method of substituting a reference with an average color of multiple samples of the same product when no reference is available, but that is not the same as averaging inside colordiff.

However, this fix is too drastic to be at the patch level, so I would like to fix this in v0.13.0.

kimikage commented 3 years ago

BTW, DE_94 seems to have a similar problem. :confused: https://en.wikipedia.org/wiki/Color_difference#CIE94 https://github.com/JuliaGraphics/Colors.jl/blob/65c4e5a56e8702ae4b1389dcd02d546a21ed2f11/src/differences.jl#L247-L253