Expand description
§rgb2spec-rs
This crate is a port of rgb2spec, an implementation of this paper by Wenzel Jakob and Johannes Hanika.
It can be used to convert RGB colors in various color spaces to coefficent representations of reflectance spectra. These spectra can then be evaluated for wavelengths in the visible spectrum.
§Example
use rgb2spec::{self, RGB2Spec};
let rgb = [1.0, 1.0, 0.3];
let rgb2spec = RGB2Spec::load("examples/out.spec")?;
let coefficients = rgb2spec.fetch(rgb);
let wavelength = 480.0;
let reflectance = rgb2spec::eval_precise(coefficients, wavelength);
Modules§
Structs§
- RGB2
Spec - A precomputed model used to convert RGB data to a coefficient representation of reflectance spectra.
Constants§
- LAMBDA_
MAX - End of the wavelength range that this crate has data for.
- LAMBDA_
MIN - Start of the wavelength range that this crate has data for.
- LAMBDA_
RANGE - Size of the wavelength range that this crate has data for.
Functions§
- eval_
precise - Used to evaluate the spectrum represented by coefficients obtained from RGB2Spec::fetch for a specific wavelength.