colour-science / colour

Colour Science for Python
https://www.colour-science.org
BSD 3-Clause "New" or "Revised" License
2.13k stars 263 forks source link

PR: Implement support for *HyAB* large color difference. #1305

Closed mesvam closed 3 weeks ago

mesvam commented 1 month ago

Summary

Implement HyAB color difference and resolves https://github.com/colour-science/colour/issues/610

Preflight

Code Style and Quality

Documentation

mesvam commented 1 month ago

I think I got the implementation correct, but could somebody double check the other stuff: documentation, tests, citation, formatting, etc.? I'm not sure I got all the tests to run correctly.

mesvam commented 3 weeks ago

I just noticed there are functions for manhattan_distance and euclidean_distance in colour.algebra. Would you prefer I use those functions to implement these difference metrics instead?

mesvam commented 3 weeks ago

what about also adding cbLAB? Would be great!

I don't mind adding cbLAB if you like, as well as some of the other metrics in that paper, but the authors recommended HyAB and HyCH as the top candidates. We can also add all four formulas, but maybe that's too much or too confusing.

Also, would you prefer that in a separate PR, or just tack it onto this one?

mesvam commented 3 weeks ago

Ok, I'm stumped. How do I pass Codacy? I can't seem to find the error messages

KelSolaar commented 3 weeks ago

I just noticed there are functions for manhattan_distance and euclidean_distance in colour.algebra. Would you prefer I use those functions to implement these difference metrics instead?

If you can wherever possible, this would be fantastic!

I would probably try to get HyCH actually if you please don't mind:

The HyAB has the best consistency with CIELAB for all categories of the second dataset. The HyCH has a good consistency with CIEDE2000 for the second dataset as well. 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. It is thus concluded that, for very large color differ- ences, the effect of lightness difference should be consid- ered perceptually separable, and the HyAB color difference formula is the most practical and accurate solution.

Ok, I'm stumped. How do I pass Codacy? I can't seem to find the error messages

Do not worry, it is all good atm!

mesvam commented 3 weeks ago

I submitted a separate PR for HyCH https://github.com/colour-science/colour/pull/1307

mesvam commented 3 weeks ago

On second thought, I think using manhattan_distance and euclidean_distance would just slow it down and make it more complicated. I'm pretty happy with this as is right now.