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

chroma.deltaE is not really Delta E #175

Closed
jiho opened this issue Apr 30, 2018 · 10 comments · Fixed by #269
Closed

chroma.deltaE is not really Delta E #175

jiho opened this issue Apr 30, 2018 · 10 comments · Fixed by #269

Comments

@jiho
Copy link

jiho commented Apr 30, 2018

Hi,
First, thanks for the great lib!

The structure of the wiki page on Delta E is not very clear but it still states that Delta E was defined by the CIE. There are various versions of the metric (76, 94, 2000), each coming with additional corrections.

The implementation of Delta E in chroma.js is that of CMC l:c which was defined by the "Colour Measurement Committee of the Society of Dyers and Colourists", not the CIE. So, even though it is defined as a subsection of the Delta E section on wikipedia, does not seem to be a Delta E metric (and the non commutability of the arguments is a tell of that).

@Offirmo proposed an implementation of Delta E 94 in #127. I implemented Delta E 2000 there (see the deltaE_lab function), albeit in R, but it should not be very hard to convert to js. It is checked against the data in the paper by Sharma et al 2005 and is correct.

I would suggest using one of those as chroma.deltaE and redefining the current deltaE as chroma.CMClc.

Thanks in advance!

@danburzo
Copy link

danburzo commented Apr 30, 2018

They are all different formulas for computing ΔE (difference in sensation). CMC l:c is a first development (1984) of the CIE76 formula, followed by CIE94 in 1994 and CIEDE2000 in 2000.

Although the Wikipedia page doesn't list them in strict chronological order, you can see in the formulas a natural progression for computing ΔE — from a simple Euclidean distance in '76, to various, and increasingly sophisticated ways of weighting the L/a/b components of the CIELab color space.

That being said, I think the state of the art (as in widespread, accurate formulas) for color differences is currently either CIEDE2000 or DIN99o (the latter being less talked-about)

@gka
Copy link
Owner

gka commented Apr 30, 2018

I think if I remember correctly I picked the CMClc because the simple Euclidean Lab distance can already be computed using chroma.distance(color1, color2, 'lab'). I think Lab is even the default color space, so you can just call chroma.distance.

Having said that I would be happy to use the deltaE 2000 as new default "deltaE" if that is more useful. I can look into the reference implementation in R.

@jiho
Copy link
Author

jiho commented Apr 30, 2018

Thanks for the precision. Indeed, the formulas are close. @gka, if you feel lazy, the 94 implementation, in js, at #127 would probably be better already (commutative at least).

@danburzo
Copy link

If it helps in any way, I've implemented the differences here as a d3 module. This Observable notebook shows how they stack up.

@gka
Copy link
Owner

gka commented Apr 30, 2018

haha, wow there's so many of them! :)

so which one is "the best"? CIE2000?

@danburzo
Copy link

Yes, CIEDE2000 is the one widely used, and is symmetrical.

PS: CIE94 — as presented on the Wikipedia page, implemented in d3-color-difference, and in #127 — is not symmetrical, since it relies on a standard color vs. a sample color. (Although it can be made symmetrical)

@trenaryja
Copy link

Hello @gka! I wanted to see if there were any plans to update the deltaE function with the CIEDE2000 formula mentioned by @jiho and @danburzo? Here is a link to a library that has implemented many of the deltaE functions in javascript already: link

I hope that this is useful! Thanks for the hard work and great lib!

@henrikhelmers
Copy link

I was also curious as to which version. I think it'd be good to add a comment that it is currently using the '94 version.

@vasilzhigilei
Copy link
Contributor

Agreed with the other users in the thread, CIE2000 would be perfect!

@vasilzhigilei
Copy link
Contributor

vasilzhigilei commented Dec 31, 2021

Hi, I've fixed the issue in this thread @gka, it can be closed after PR merge. #269

@gka gka closed this as completed in #269 Jan 27, 2022
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.

6 participants