palette::color_difference

Trait HyAb

source
pub trait HyAb {
    type Scalar;

    // Required method
    fn hybrid_distance(self, other: Self) -> Self::Scalar;
}
Expand description

Calculate a combination of Euclidean and Manhattan/City-block distance between two colors.

The HyAB distance was suggested as an alternative to CIEDE2000 for large color differences in Distance metrics for very large color differences (in Color Res Appl. 2019;1–16) by Saeedeh Abasi, Mohammad Amani Tehran and Mark D. Fairchild. It’s originally meant for CIE L*a*b* (CIELAB), but this trait is also implemented for other color spaces that have similar semantics, although without the same quality guarantees.

The hybrid distance is the sum of the absolute lightness difference and the distance on the chroma plane. This makes the lightness and chroma differences more independent from each other, which is meant to correspond more to how humans perceive the two qualities.

Required Associated Types§

source

type Scalar

The type for the distance value.

Required Methods§

source

fn hybrid_distance(self, other: Self) -> Self::Scalar

Calculate the hybrid distance between self and other.

This returns the sum of the absolute lightness difference and the distance on the chroma plane.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> HyAb for Cam16UcsJab<T>
where T: Real + Abs + Sqrt + Sub<T, Output = T> + Add<T, Output = T> + Mul<T, Output = T> + Clone,

source§

impl<T> HyAb for Oklab<T>
where T: Real + Abs + Sqrt + Sub<T, Output = T> + Add<T, Output = T> + Mul<T, Output = T> + Clone,

source§

impl<Wp, T> HyAb for Lab<Wp, T>
where T: Real + Abs + Sqrt + Sub<T, Output = T> + Add<T, Output = T> + Mul<T, Output = T> + Clone,

source§

impl<Wp, T> HyAb for Luv<Wp, T>
where T: Real + Abs + Sqrt + Sub<T, Output = T> + Add<T, Output = T> + Mul<T, Output = T> + Clone,