pysdic.OrthographicExtrinsic._apply#

OrthographicExtrinsic._apply(world_points, *, dx=False, dp=False)[source]#

Compute the transformation from 3D world points to 2D normalized points.

The transformation consists of a change of reference frame followed by the orthographic projection:

\[\begin{split}\vec{X}_c = R \cdot \vec{X}_w + T, \qquad \vec{x}_n = \begin{bmatrix} X_c \\ Y_c \end{bmatrix} = P \vec{X}_c \quad \text{with} \quad P = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \end{bmatrix}\end{split}\]

The Jacobian with respect to the world points is constant:

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

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

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

where \(\frac{\partial R}{\partial r_k}\) is given by cv2.Rodrigues.

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

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

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

Returns:

  • normalized_points (numpy.ndarray) – The normalized points in camera coordinates. Shape (n_points, 2).

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

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

Return type:

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