pycvcam.Cv2Intrinsic._transform#

Cv2Intrinsic._transform(distorted_points, *, dx=False, dp=False)[source]#

Compute the transformation from the distorted_points to the image_points.

Lets consider distorted_points in the camera normalized coordinate system \(\vec{x}_d = (x_d, y_d)\), the corresponding image_points in the image coordinate system are given by :

The equation used for the intrinsic transformation is:

\[x_i = f_x \cdot x_d + c_x\]
\[y_i = f_y \cdot y_d + c_y\]

The jacobians with respect to the intrinsic parameters is an array with shape (n_points, 2, 4), where the last dimension represents the parameters (fx, fy, cx, cy). The jacobian with respect to the distorted points is an array with shape (n_points, 2, 2).

Warning

This method is not intended to be used directly, but rather through the pycvcam.core.Transform.transform() method. Please ensure, the shape of the input distorted_points is (n_points, 2) before calling this method.

Parameters:
  • distorted_points (numpy.ndarray) – The distorted points in camera normalized coordinates to be transformed. Shape (n_points, 2).

  • 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 intrinsic parameters is computed. Default is False

Returns:

  • image_points (numpy.ndarray) – The image points in image coordinates, which are equal to the x and y componants of the distorted points. Shape (n_points, 2).

  • jacobian_dx (Optional[numpy.ndarray]) – The jacobian of the image points with respect to the distorted points. Shape (n_points, 2, 2) if dx is True, otherwise None.

  • jacobian_dp (Optional[numpy.ndarray]) – The jacobian of the image points with respect to the intrinsic parameters. Shape (n_points, 2, 4) if dp is True, otherwise None.

Return type:

Tuple[ndarray, ndarray | None, ndarray | None]