Skip to main content

background_intensity_sample

Function background_intensity_sample 

Source
pub fn background_intensity_sample(
    rgb: &[u8],
    percentile: f32,
) -> Result<RgbBg, HistoError>
Expand description

Sample background as the mean RGB of pixels whose luminance is at or above the given percentile (e.g. percentile = 95.0 → top ~5% brightest).

Uses a 256-bin luminance histogram (BT.601 integer) so the hot path is stack-only; no heap.