CV Solve PnP (Pose)
Estimates the pose (rotation + translation) of a known set of 3D object points seen at given 2D image points (cv2.solvePnP) - e.g. a chessboard or planar marker for augmented reality. Failure-tolerant like 'CV Find Homography': fewer than 4 points, a count mismatch or a degenerate configuration returns found=false with zero rvec/tvec instead of raising. Feed object_points (a planar grid from 'CV Grid Points', or any 'CV Points'), the matching image_points (cv2.findChessboardCorners / Match Features / goodFeaturesToTrack) and a camera matrix ('CV Camera Matrix' or 'Calibrate Camera'); the rvec/tvec drive cv2.projectPoints / drawFrameAxes to overlay a 3D object. Branch on 'found' with a control-flow node to skip the overlay when nothing was detected.
- object_points
- image_points
- camera_matrix
- dist_coeffs
- rvec
- tvec
- found
- inliers
- inlier_count
- reproj_error
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| object_points | NPARRAY | 3D points in object space, Nx3 or Nx1x3 (e.g. 'CV Grid Points' for a chessboard, or 'CV Points' for a cube). | |
| image_points | NPARRAY | The matching 2D image points, Nx2 or Nx1x2, in the same order as object_points (e.g. findChessboardCorners). | |
| camera_matrix | NPARRAY | 3x3 intrinsic matrix K ('CV Camera Matrix' or 'Calibrate Camera'). | |
| method | COMBO | SOLVEPNP_ITERATIVE | PnP solver. ITERATIVE (Levenberg-Marquardt) is the general default; IPPE/IPPE_SQUARE are for planar targets. |
| dist_coeffsopt | NPARRAY | Lens distortion coefficients (k1, k2, p1, p2[, k3...]); leave unconnected for an ideal pinhole camera (no distortion). | |
| estimationopt | COMBO | all points (least squares) | 'all points' fits every correspondence - correct for a chessboard or marker, where they are all good. 'RANSAC' tolerates wrong correspondences and is what feature matches or stereo-derived 3D points need; it also fills the 'inliers' output. |
| reprojection_erroropt | FLOAT | 3.00.1–100 | RANSAC only: how many pixels a point may miss its reprojection by and still count as an inlier. |
| ransac_iterationsopt | INT | 10001–100000 | RANSAC only: maximum sampling iterations. |
| confidenceopt | FLOAT | 0.9990–1 | RANSAC only: probability that the returned pose comes from an all-inlier sample. |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| rvec | NPARRAY | 3x1 Rodrigues rotation vector (zeros if not found). Pass to cv2.projectPoints / drawFrameAxes / Rodrigues / 'CV Pose To Matrix'. |
| tvec | NPARRAY | 3x1 translation vector (zeros if not found). |
| found | BOOLEAN | — |
| inliers | NPARRAY | Nx1 uint8 mask of the correspondences RANSAC kept (all 255 for the 'all points' estimation, all 0 if not found). Filter the matches with 'CV Filter Points By Mask' / 'CV Filter Points 3D By Mask'. |
| inlier_count | INT | — |
| reproj_error | FLOAT | Mean reprojection error in pixels over the inliers - the quality number for this pose (under ~1-3 px is a good fit). 0 when not found. |