Skip to main content

letterbox_preprocess

Function letterbox_preprocess 

Source
pub fn letterbox_preprocess(
    image: &Tensor,
    target_size: usize,
) -> (Tensor, f32, f32, f32)
Expand description

Apply letterbox preprocessing: resize an image to a square with padding.

The input image is an [H, W, 3] f32 tensor (RGB, normalised to 0..1). Returns (padded, scale, pad_x, pad_y) where padded has shape [target_size, target_size, 3].