pycvcam.Cv2Intrinsic._transform#

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

Apply the intrinsic projection from distorted normalized coordinates to image pixel coordinates.

Let \(\vec{x}_d = (x_d, y_d)\) be a point in distorted normalized camera coordinates. The corresponding image point \(\vec{x}_i = (x_i, y_i)\) is obtained using the intrinsic parameters \((f_x, f_y, c_x, c_y)\):

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

The Jacobian with respect to the distorted points has shape (n_points, 2, 2) and corresponds to

\[\frac{\partial \vec{x}_i}{\partial \vec{x}_d}\]

The Jacobian with respect to the intrinsic parameters has shape (n_points, 2, 4) and corresponds to

\[\frac{\partial \vec{x}_i}{\partial (f_x, f_y, c_x, c_y)}\]

Warning

This method is intended for internal use. It should normally be called through pycvcam.core.Transform.transform().

Parameters:
  • distorted_points (numpy.ndarray) – Distorted normalized camera coordinates. Shape (n_points, 2).

  • dx (bool, optional) – If True, compute the Jacobian with respect to the input points.

  • dp (bool, optional) – If True, compute the Jacobian with respect to the intrinsic parameters.

Returns:

  • image_points (numpy.ndarray) – Image coordinates computed from the intrinsic projection. Shape (n_points, 2).

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

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

Return type:

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