pycvcam.Cv2Extrinsic._transform#
- Cv2Extrinsic._transform(world_points, *, dx=False, dp=False)[source]#
Compute the transformation from 3D world points to 2D normalized camera points.
The transformation consists of a change of reference frame followed by perspective normalization:
Transform world to camera coordinates:
\[\vec{X}_c = R \cdot \vec{X}_w + T\]Normalize camera coordinates:
\[\vec{x}_n = \frac{1}{Z_c} \cdot \vec{X}_c\]where:
\(\vec{X}_w\) : 3D point in the world coordinate system.
\(\vec{X}_c\) : 3D point in the camera coordinate system.
\(R\) : 3×3 rotation matrix.
\(T\) : 3×1 translation vector.
\(Z_c\) : depth of the point in camera coordinates.
\(\vec{x}_n\) : normalized 2D point in the camera plane.
Warning
This method is intended to be used internally by
pycvcam.Transform.transform(). Ensure world_points has shape (n_points, 3) before calling.- Parameters:
world_points (numpy.ndarray) – Input 3D points in world coordinates. Shape (n_points, 3).
dx (bool, optional) – If True, compute the Jacobian with respect to the input 3D points. Default is False.
dp (bool, optional) – If True, compute the Jacobian with respect to the extrinsic parameters. Default is False.
- 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 is True, else None.
jacobian_dp (Optional[numpy.ndarray]) – Jacobian of normalized points with respect to extrinsic parameters. Shape (n_points, 2, 6) if dp is True, else None.
- Return type:
Jacobians#
dx: Jacobian of normalized points with respect to world points. Shape (n_points, 2, 3).
dp: Jacobian of normalized points with respect to extrinsic parameters (rotation vector + translation vector). Shape (n_points, 2, 6).