phomo

Trait ColorMatch

Source
pub trait ColorMatch: ToLab + ToSrgb {
    // Required methods
    fn mean(&self) -> [f32; 3];
    fn std(&self, mean: &[f32; 3]) -> [f32; 3];
    fn match_palette(&self, other: &impl ColorMatch) -> Self;
    fn equalize(&self) -> Self;
}

Required Methods§

Source

fn mean(&self) -> [f32; 3]

Compute the mean color.

Source

fn std(&self, mean: &[f32; 3]) -> [f32; 3]

Compute the stadndard deviation of the color channel distributions.

Source

fn match_palette(&self, other: &impl ColorMatch) -> Self

Transfer the color palette of the other onto self, using the Reinhard color transfer algorithm.

See: https://api.semanticscholar.org/CorpusID:14088925

It matches the mean and standard deviations in the Oklab color space, then projects back to Srgb.

Source

fn equalize(&self) -> Self

Equalize the color distribution.

See: https://docs.opencv.org/4.x/d5/daf/tutorial_py_histogram_equalization.html

It spreads out the distribution such that they cover the full color space.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ColorMatch for Vec<RgbImage>

Source§

fn mean(&self) -> [f32; 3]

Source§

fn std(&self, mean: &[f32; 3]) -> [f32; 3]

Source§

fn match_palette(&self, other: &impl ColorMatch) -> Vec<RgbImage>

Source§

fn equalize(&self) -> Vec<RgbImage>

Source§

impl ColorMatch for RgbImage

Source§

fn mean(&self) -> [f32; 3]

Source§

fn std(&self, mean: &[f32; 3]) -> [f32; 3]

Source§

fn match_palette(&self, other: &impl ColorMatch) -> RgbImage

Source§

fn equalize(&self) -> RgbImage

Implementors§