preprocess_image

Function preprocess_image 

Source
pub fn preprocess_image(
    data_uri: &str,
    vcfg: &VisionConfig,
) -> Result<(Vec<f32>, usize, usize)>
Expand description

2026-09-25: Preprocess one base64-encoded image with no max_pixels bound.

Returns:

  • pixels: flat f32 tensor shaped [P, C × T × H_p × W_p] where:
    • P = (H/patch_size) × (W/patch_size) — number of patches
    • C = 3 channels, T = temporal_patch_size (image duplicated), H_p = W_p = patch_size
  • grid_h: number of patches along height
  • grid_w: number of patches along width