pysdic.distort_points#

distort_points(image_points, intrinsic, distortion, R=None, P=None, *, dx=False, dp=False, bypass_dp=None, intrinsic_kwargs=None, distortion_kwargs=None, R_kwargs=None, P_kwargs=None)[source]#

Distort 2D image points \(\vec{x}_i\) with the inverse of the camera intrinsic and the distortion transformation, to obtain the distorted points \(\vec{x}_d\), or the transformed points \(\vec{x}_u\) if R or P are given.

\[\begin{split}\vec{x}_n &= \text{Intrinsic}^{-1}(\vec{x}_i) \\ \vec{x}_d &= \text{Distortion}(\vec{x}_n) \\ \vec{x}_u &= P(R(\vec{x}_d))\end{split}\]

Where:

  • \(\vec{x}_i\) are the 2D image points in the image coordinate system.

  • \(\vec{x}_n\) are the 2D normalized points in the normalized coordinate system.

  • \(\vec{x}_d\) are the 2D distorted points in the normalized coordinate system.

  • \(\vec{x}_u\) are the 2D transformed points in the space required by the user.

If \(R\) takes 3D points, the distorted points are first lifted to \((x_d, y_d, 1)\).

Note

The behavior of the function can be adapted by giving the appropriate transformations:

  • Use intrinsic=None to give directly the normalized points in the normalized coordinate system.

  • Use P=intrinsic to return the distorted points in the image coordinate system.

  • Use intrinsic=None and P=None if the distortion model is defined in the image coordinate system.

The Jacobians and the arguments are the same as for pysdic.undistort_points(), except that the distortion is applied (distortion_kwargs are passed to its apply method).

See also

Parameters:
Returns:

The distorted (or transformed) points x with shape \((\dots, 2)\) and the Jacobians if requested.

Return type:

pysdic.DistortionResult

Examples

Distort the image points of a perfect pinhole camera and return them in the image coordinate system:

distorted_points = distort_points(image_points, intrinsic, distortion, P=intrinsic).x