pycvcam.core.Distortion.undistort#

Distortion.undistort(distorted_points, *, transpose=False, dx=False, dp=False, **kwargs)[source]#

Alias for the inverse_transform method, which applies the inverse distortion transformation to the points.

See also

Note

The distorted_points is converted to a numpy array of dtype=numpy.float64.

Parameters:
  • distorted_points (ArrayLike) – The distorted points to be transformed. Shape (…, 2).

  • transpose (bool, optional) – If True, the input points are assumed to have shape (2, …) instead of (…, 2) and the output points will have shape (2, …). Default is False.

  • dx (bool, optional) – If True, the jacobian with respect to the distorted points is computed. Default is False.

  • dp (bool, optional) – If True, the jacobian with respect to the distortion parameters is computed. Default is False

Returns:

The result of the inverse transformation, which includes the normalized_points and the Jacobian matrices if available.

Return type:

TransformResult

Examples

distortion = ... # An instance of a subclass of Distortion

import numpy

distorted_points = numpy.array([[0.0, 0.0], [1.0, 1.0], [2.0, 2.0]]) # shape (n_points, 2)
result = distortion.undistort(distorted_points)
normalized_points = result.normalized_points  # shape (n_points, 2)

# SAME AS:
result = distortion.inverse_transform(distorted_points)
normalized_points = result.transformed_points  # shape (n_points, 2)