vpi.WarpMap

class vpi.WarpMap(grid: vpi.WarpGrid) vpi.WarpMap
class vpi.WarpMap(regions: Tuple[List[int], List[int]], intervals: Tuple[List[int], List[int]]) vpi.WarpMap
class vpi.WarpMap(size: Tuple[int, int], interval: Union[int, Tuple[int, int]] = None) vpi.WarpMap

Creates warpmap for Lens Distortion Correction.

It defines the mapping between input and output images’ pixels. It is used by vpi.Image.remap(). Warp map holds the mapping from output to input images. It allows both dense and sparse mapping.

Parameters
  • grid (vpi.WarpGrid) – The warp grid control point structure.

  • regions (Tuple[List[int], List[int]]) – The width and height of each region, respectively. See C API for details.

  • intervals (Tuple[List[int], List[int]])) – The horizontal and vertical intervals, respectively. They are the spacing between control points within a given region. See C API for details.

  • size (Tuple[int, int]) – The dimensions of the image.

  • interval (Union[int, Tuple[int, int]], optional) – The interval.

Returns

The warp map.

Return type

vpi.WarpMap

See also

Read more in the C API references of the group concepts.

static fisheye_correction(grid: vpi.WarpGrid, Kin: 2D array, X: 2D array, Kout: 2D array, coeffs: 1D array, mapping: vpi.FisheyeMapping) vpi.WarpMap
static fisheye_correction(grid: vpi.WarpGrid, Kin: 2D array, X: 2D array, coeffs: 1D array, mapping: vpi.FisheyeMapping) vpi.WarpMap

Does fisheye correction.

Generates a mapping that corrects image using fisheye lens distortion model.

See also

Refer to the algorithm explanation for more details and usage examples.

Parameters
  • grid (vpi.WarpGrid) – The warp grid.

  • Kin (2D array of float) – The camera intrinsic parameters. Expects 2x3 matrix.

  • X (2D array of float) – The camera extrinsic parameters that defines the camera center position and its heading in world coordinates. Expects 3x4 matrix.

  • Kout (2D array of float, optional) – New camera intrinsic parameters applied to the undistorted image. Set Kout the same as Kin if missing (monocular camera). Expects 2x3 matrix.

  • coeffs (1D array of float) – The distortion coefficients.

  • mapping (vpi.FisheyeMapping) – The fisheye lens mapping type.

Returns

The warp map.

Return type

vpi.WarpMap

Note

Read more on the C API references of the group concepts.

static polynomial_correction(grid: vpi.WarpGrid, Kin: 2D array, X: 2D array, Kout: 2D array, rcoeffs: 1D array, tcoeffs: 1D array = None) vpi.WarpMap
static polynomial_correction(grid: vpi.WarpGrid, K: 2D array, X: 2D array, rcoeffs: 1D array, tcoeffs: 1D array = None) vpi.WarpMap

Does polynomial correction.

Generates a mapping that corrects image using polynomial lens distortion model.

See also

Refer to the algorithm explanation for more details and usage examples.

Parameters
  • grid (vpi.WarpGrid) – The warp grid.

  • Kin (2D array of float) – The camera intrinsic parameters. Expects 2x3 matrix.

  • X (2D array of float) – The camera extrinsic parameters that defines the camera center position and its heading in world coordinates. Expects 3x4 matrix.

  • Kout (2D array of float, optional) – New camera intrinsic parameters applied to the undistorted image. Set Kout the same as Kin if missing (monocular camera). Expects 2x3 matrix.

  • rcoeffs (1D array of float) – The radial distortion coefficients.

  • tcoeffs (1D array of float, optional) – The tangential distortion coefficients.

Returns

The warp map.

Return type

vpi.WarpMap

See also

Read more in the C API references of the group concepts.

Attributes

grid

The vpi.WarpGrid of the warp map.