-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add the HyAB color difference metric #328
Conversation
@okaneco, you may want to have a look at this, so I don't make too many things up in the documentation. I would appreciate an extra pair of eyes, if you want to/have time. 🙂 |
Benchmark for ce40517Click to view benchmark
|
palette/src/color_difference.rs
Outdated
//! |-------|------------|----------|-------| | ||
//! | [`Ciede2000`] | High | High for small differences, lower for large differences | The de-facto standard, but requires complex calculations to compensate for increased errors in certain areas of the CIE L\*a\*b\* (CIELAB) space. | ||
//! | [`EuclideanDistance`] | Low | Medium to high for perceptually uniform spaces, otherwise low | Can be good enough for perceptually uniform spaces or as a "quick and dirty" check. | ||
//! | [`HyAb`] | Low | High for large differences, compared to CIEDE2000, for CIE L\*a\*b\* (CIELAB) | Similar to Euclidean distance, but separates lightness and chroma more. Limited to Cartesian spaces with a lightness axis and a chroma plane. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think HyAb
is presented as being a "good enough" option even for smaller differences according to the conclusion. It's not as accurate as Ciede2000
for small differences but the performance benefits outweigh the loss of accuracy for general purpose uses.
It is reasonable to conclude that the HyAB formula has the best correlation with visual observations for very large color differences. It has the best performance for the first category and third category of the first dataset. It
also holds up well for smaller color differences and thus is a good candidate formula for image processing and
computer vision applications.
...
So, the HyAB and HyCH could be used for small to large color difference calculation. However, the HyAB has a slightly better performance and the advantage of simpler computation.
In summary, something like
High accuracy for medium to large differences. Less accurate than
Ciede2000
for small differences, but still performs well and is much less computationally expensive.
Everything else looks good 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yeah, I missed that part. I'll update it! I think I'll also highlight that the WCAG 2.1 contrast only checks lightness. Thanks for having a look and I hope you didn't mind the ping!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, glad to help.
Good idea on the highlight in the relative contrast notes. I would expand the explanation of computer graphics slightly,
Meant for checking contrast in computer graphics (such as between text and background colors)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's good to clarify. 👍
Benchmark for f911acfClick to view benchmark
|
Benchmark for 0ce86d9Click to view benchmark
|
bors r+ |
Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
Adds the HyAB color distance metric for
Lab
,Oklab
andLuv
. It's primarily only meant for CIELAB, but I figured it may translate well to the other two as well, since they have similar semantics.I have also added a summary of the available difference metrics in the module description. It's not exactly precise or scientific, but may still be helpful.
Closed Issues