pub fn tonal_flatness(img: &CaptureImage, bg: [u8; 4], eps: u8) -> f32Expand description
Share of the lit figure whose luminance falls inside the single most
populated narrow luminance band (0.0..=1.0) — “does this picture have any
tonal structure”.
coverage and quadrant_spread answer is something there and is it more
than a dot, and a fully saturated single-tone mass satisfies both: it is a
real shape, of the right size, in every quadrant. This asks the question they
cannot — whether the shape has any interior. A figure with falloff, depth or
modelling spreads across several buckets; one driven past the tonemap knee
collapses into one and reads near 1.0.
Measured over lit pixels only, against the frame’s own sampled background,
for the same reason coverage is: a sparse figure on a wide ground would
otherwise report the background’s flatness, which is total by construction
and says nothing about the scene.
0.0 for a frame with no lit pixels at all — an empty picture makes no claim
here, and coverage is the metric that already convicts it.