pycvcam.Cv2Extrinsic._inverse_transform#
- Cv2Extrinsic._inverse_transform(normalized_points, *, dx=False, dp=False, depth=None)[source]#
Compute the inverse transformation from 2D normalized camera points to 3D world points.
The inverse transformation consists of un-normalizing the points in the camera coordinate system and then applying the inverse extrinsic transformation:
Un-normalize points in camera coordinates:
\[\vec{X}_c = \vec{x}_n \cdot Z_c\]Transform camera coordinates to world coordinates:
\[\vec{X}_w = R^{-1} \cdot (\vec{X}_c - T)\]where:
\(\vec{x}_n\) : normalized 2D point in the camera plane.
\(Z_c\) : depth of the point in camera coordinates. If not provided, assumed 1.0.
\(\vec{X}_c\) : 3D point in camera coordinates.
\(\vec{X}_w\) : 3D point in world coordinates.
\(R\) : 3×3 rotation matrix.
\(T\) : 3×1 translation vector.
Warning
This method is intended to be used internally by
pycvcam.Transform.inverse_transform(). Ensure normalized_points has shape (n_points, 2) and depth (if provided) matches the number of points.- Parameters:
normalized_points (numpy.ndarray) – Input 2D normalized points in camera coordinates. Shape (n_points, 2).
dx (bool, optional) – If True, compute the Jacobian with respect to normalized points. Default is False.
dp (bool, optional) – If True, compute the Jacobian with respect to extrinsic parameters. Default is False.
depth (Optional[numpy.ndarray], optional) – Depth of each point in camera coordinates. If None, all depths are assumed to be 1.0. Shape should match the number of points in normalized_points.
- 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 is True, else None.
jacobian_dp (Optional[numpy.ndarray]) – Jacobian of world points with respect to extrinsic parameters. Shape (n_points, 3, 6) if dp is True, else None.
- Return type:
Jacobians#
dx: Jacobian of world points with respect to normalized points. Shape (n_points, 3, 2).
dp: Jacobian of world points with respect to extrinsic parameters (rotation vector + translation vector). Shape (n_points, 3, 6).