Skip to main content

unletter_norm

Function unletter_norm 

Source
pub fn unletter_norm(b: BoundingBox, lb: [f32; 4]) -> BoundingBox
Expand description

Invert a letterbox: map a BoundingBox normalized over the model input back to normalized-over-the-crop, given the content bounds [lx0, ly0, lx1, ly1]. The box is canonicalised first, a degenerate (zero-span) letterbox axis maps with unit scale (no divide-by-zero), and the result is clamped to [0, 1].

This is the single home for the inverse-letterbox transform; edgefirst_image::unletter_bbox is a thin wrapper around it (the image crate depends on decoder, so the shared math lives here, in the lower crate).