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
RorPare 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=Noneto give directly the normalized points in the normalized coordinate system.Use
P=intrinsicto return the distorted points in the image coordinate system.Use
intrinsic=NoneandP=Noneif 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_kwargsare passed to itsapplymethod).See also
Class
pysdic.DistortionResultfor the result.Function
pysdic.undistort_points()for the opposite direction.
- Parameters:
image_points (ArrayLike) – The 2D image points in the image coordinate system. Shape \((\dots, 2)\).
intrinsic (Optional[Transformation]) – The intrinsic transformation (2D to 2D), inverted on the image points. If None, no intrinsic is applied (identity).
distortion (Optional[Transformation]) – The distortion transformation (2D to 2D), applied to the normalized points. If None, no distortion is applied (identity).
R (Transformation | None) – See
pysdic.undistort_points().P (Transformation | None) – See
pysdic.undistort_points().dx (bool) – See
pysdic.undistort_points().dp (bool) – See
pysdic.undistort_points().bypass_dp (Sequence[bool] | None) – See
pysdic.undistort_points().intrinsic_kwargs (Dict[str, Any] | None) – See
pysdic.undistort_points().R_kwargs (Dict[str, Any] | None) – See
pysdic.undistort_points().P_kwargs (Dict[str, Any] | None) – See
pysdic.undistort_points().distortion_kwargs (Optional[Dict[str, Any]], optional (default:
None)) – Additional keyword arguments passed to theapplymethod of the distortion transformation.
- Returns:
The distorted (or transformed) points
xwith shape \((\dots, 2)\) and the Jacobians if requested.- Return type:
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