Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-standard implementation of DE_CMC and DE_94 #438

Closed
kimikage opened this issue Aug 24, 2020 · 1 comment · Fixed by #461
Closed

Non-standard implementation of DE_CMC and DE_94 #438

kimikage opened this issue Aug 24, 2020 · 1 comment · Fixed by #461
Milestone

Comments

@kimikage
Copy link
Collaborator

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.

# Find the mean value of the inputs to use as the "standard"
ml, mc = (a.l + b.l)/2, (a.c + b.c)/2

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.
# L* adjustment term
if (a.l <= 16)
sl = 0.511
else
sl = 0.040975*ml/(1+0.01765*ml)
end

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
Copy link
Collaborator Author

BTW, DE_94 seems to have a similar problem. 😕
https://en.wikipedia.org/wiki/Color_difference#CIE94

# Calculate geometric mean of chroma
mc = sqrt(a.c*b.c)
# Lightness, hue, chroma correction terms
sl = 1
sc = 1+0.045*mc
sh = 1+0.015*mc

@kimikage kimikage changed the title Non-standard implementation of DE_CMC Non-standard implementation of DE_CMC and DE_94 Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant