pysdic.OrthographicExtrinsic._invert#

OrthographicExtrinsic._invert(normalized_points, *, dx=False, dp=False, depth=None)[source]#

Compute the inverse transformation from 2D normalized points to 3D world points at a given depth.

The normalized points are placed at the depth \(Z_c\) in the camera coordinate system and transformed back to world coordinates:

\[\begin{split}\vec{X}_c = \begin{bmatrix} x_n \\ y_n \\ Z_c \end{bmatrix}, \qquad \vec{X}_w = R^T \cdot (\vec{X}_c - T)\end{split}\]

The Jacobian with respect to the normalized points is constant (the depth is fixed):

\[\frac{\partial \vec{X}_w}{\partial \vec{x}_n} = R^T P^T\]

The Jacobian with respect to the parameters \((\vec{r}, T)\) is:

\[\frac{\partial \vec{X}_w}{\partial r_k} = \frac{\partial R}{\partial r_k}^T (\vec{X}_c - T), \qquad \frac{\partial \vec{X}_w}{\partial T} = - R^T\]

Note

The depth is an additional argument of invert: extrinsic.invert(points, depth=...).

Parameters:
  • normalized_points (numpy.ndarray) – Input 2D normalized points in camera coordinates. Shape (n_points, 2).

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

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

  • depth (Optional[ArrayLike], optional (default: None)) – Depth \(Z_c\) of the points in camera coordinates. It can be a scalar or an array with one value per point (with the same batch shape as the points passed to invert). If None, all depths are equal to 1.0.

Returns:

  • world_points (numpy.ndarray) – 3D points in world coordinates. Shape (n_points, 3).

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

  • jacobian_dp (Optional[numpy.ndarray]) – Jacobian of world points with respect to extrinsic parameters. Shape (n_points, 3, 6) if dp=True, otherwise None.

Return type:

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