Skip to main content

rescale_descriptors_to_input

Function rescale_descriptors_to_input 

Source
pub fn rescale_descriptors_to_input(
    descriptors: &mut [CornerDescriptor],
    factor: u32,
)
Expand description

Rescale corner positions from an upscaled image back to the original input-image pixel frame.

Uses the inverse of the forward half-pixel-center mapping from upscale_bilinear_u8:

forward : x_out = (x_src + 0.5) * k - 0.5
inverse : x_src = (x_out + 0.5) / k - 0.5
        = x_out / k - (k - 1) / (2k)

A naive x /= k biases returned coordinates by (k − 1) / (2k) pixels (+0.25 px at k = 2). Axis angles and sigmas are scale-invariant and are left untouched.