pysdic.PinholeIntrinsic._apply#

PinholeIntrinsic._apply(distorted_points, *, dx=False, dp=False)[source]#

Apply the intrinsic projection from distorted normalized coordinates to image 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:

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

The Jacobian with respect to the distorted points is constant:

\[\begin{split}\frac{\partial \vec{x}_i}{\partial \vec{x}_d} = \begin{bmatrix} f_x & s \\ 0 & f_y \end{bmatrix}\end{split}\]

The Jacobian with respect to the intrinsic parameters \((f_x, f_y, c_x, c_y, s)\) is:

\[\begin{split}\frac{\partial \vec{x}_i}{\partial (f_x, f_y, c_x, c_y, s)} = \begin{bmatrix} x_d & 0 & 1 & 0 & y_d \\ 0 & y_d & 0 & 1 & 0 \end{bmatrix}\end{split}\]

where the last column only exists if use_skew=True.

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

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

  • dp (bool, optional (default: False)) – 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, n_parameters) if dp=True, otherwise None.

Return type:

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