pycvcam.OrthographicExtrinsic._compute_rays#

OrthographicExtrinsic._compute_rays(normalized_points)[source]#

Compute the 3D rays from the camera to the scene in world coordinates.

Each ray consists of:

  • The origin: the 3D position of the point in world coordinates.

  • The direction: a unit vector pointing from the camera center to the point in world coordinates.

Let:

  • \(\vec{X}_n\) be the 3D normalized points in camera coordinates with coordinates (x_n, y_n, 1.0).

  • \(R\) be the rotation matrix of the extrinsic transformation.

  • \(T\) be the translation vector of the extrinsic transformation.

Then the transformation to world coordinates is:

\[ \begin{align}\begin{aligned}\vec{X}_w = R^{-1} \cdot (\vec{X}_n - T)\\\vec{D}_w = R^{-1} \cdot (0, 0, 1)^\top\end{aligned}\end{align} \]

Here, \(\vec{D}_w\) is constant for all points, reflecting the parallel rays of the orthographic projection.

Parameters:

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

Returns:

Rays in world coordinates. Shape (n_points, 6), where the first three elements of each row are the origin (x, y, z) and the last three elements are the normalized direction (dx, dy, dz).

Return type:

numpy.ndarray