pub fn preprocess_image(
rgb: &[u8],
h_in: usize,
w_in: usize,
) -> (Vec<f32>, (usize, usize))Expand description
Resize an RGB u8 image to fit within SAM_IMG_SIZE on the long
side (aspect-ratio preserved), normalize with SAM’s pixel stats,
and zero-pad to a square [3, 1024, 1024] NCHW f32 tensor.
rgb is H_in · W_in · 3 row-major (u8). Returns (nchw, (h, w))
where (h, w) are the resized (pre-pad) dimensions — needed at the
decoder to crop predicted masks back to the original aspect ratio.