Skip to main content

Mojo function

map_output_to_input_coord

map_output_to_input_coord(output_coord: Int, scale: SIMD[float32, 1]) -> SIMD[float32, 1]

Map output pixel coordinate to input coordinate using center alignment. This implements the standard coordinate mapping for image resizing: input_coord = (output_coord + 0.5) * scale - 0.5 The +0.5 and -0.5 terms ensure pixel centers are aligned properly. Args: output_coord: Output pixel coordinate. scale: Scale factor (input_size / output_size). Returns: Corresponding input coordinate as a float.

Was this page helpful?