pysdic.PinholeIntrinsic._invert#

PinholeIntrinsic._invert(image_points, *, dx=False, dp=False)[source]#

Apply the inverse of the intrinsic projection from image coordinates to distorted normalized coordinates.

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

\[y_d = \frac{y_i - c_y}{f_y}\]
\[x_d = \frac{x_i - s \cdot y_d - c_x}{f_x}\]

The Jacobian with respect to the image points is constant:

\[\begin{split}\frac{\partial \vec{x}_d}{\partial \vec{x}_i} = \begin{bmatrix} \frac{1}{f_x} & -\frac{s}{f_x f_y} \\ 0 & \frac{1}{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}_d}{\partial (f_x, f_y, c_x, c_y, s)} = \begin{bmatrix} -\frac{x_d}{f_x} & \frac{s \, y_d}{f_x f_y} & -\frac{1}{f_x} & \frac{s}{f_x f_y} & -\frac{y_d}{f_x} \\ 0 & -\frac{y_d}{f_y} & 0 & -\frac{1}{f_y} & 0 \end{bmatrix}\end{split}\]

where the last column only exists if use_skew=True (and \(s = 0\) otherwise).

Parameters:
  • image_points (numpy.ndarray) – Image coordinates. Shape (n_points, 2).

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

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

Returns:

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

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

  • jacobian_dp (Optional[numpy.ndarray]) – Jacobian of the distorted 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]