Ogeon / palette

A Rust library for linear color calculations and conversion
Apache License 2.0
748 stars 60 forks source link

Implement HyAB color difference metric #318

Closed okaneco closed 1 year ago

okaneco commented 1 year ago

Copied from https://github.com/Ogeon/palette/issues/288#issuecomment-1519012587

The HyAB (hybrid model of |delta L*| + Euclidean(a*, b*)) color distance metric is presented in Equation 3 on page 4. It seems like it could be a good addition to Lab because it separates the effect of luma and chroma/hue in color difference calculation while remaining computationally simple. Unfortunately, the Lch Manhattan distance and hybrid models require calculating the expensive factors in the DE2000 calculation and perform slightly worse overall than HyAB, so they probably wouldn't be used as much and seem like less of a priority. http://markfairchild.org/PDFs/PAP40.pdf

Ogeon commented 1 year ago

Thanks! I wonder if it would make sense to implement it for similar spaces, such as OkLab and Luv. It wouldn't be the exact same but they have similar properties (a lightness axis and a chroma plane). It would perhaps be a bit like Euclidean distance in the sense that it's not perfect but still maybe applicable.