ComfyUI Node
CV Solve PnP (All Poses)
The MULTI-SOLUTION pose solver: where 'CV Solve PnP (Pose)' commits to one answer, this returns EVERY pose consistent with the correspondences, each with its own reprojection error (cv2.solveP3P / cv2.solvePnPGeneric). That matters when the geometry is genuinely ambiguous - three points (P3P) admit up to four poses, and a planar target viewed near head-on has a well-known two-fold flip (IPPE returns both). Use 'best_index' with 'CV Index Batch' for the lowest-error candidate, or keep the whole stack and disambiguate with extra evidence. Failure tolerant: too few points, a count mismatch or a degenerate configuration gives found=false with empty stacks instead of raising.
CV Solve PnP (All Poses)
- object_points
- image_points
- camera_matrix
- dist_coeffs
- rvecs
- tvecs
- reprojection_error
- count
- best_index
- found
◄solvergeneric - every solution the method finds►
◄methodSOLVEPNP_ITERATIVE►
Categoryimage/CV/features
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| object_points | NPARRAY | 3D points in object space, Nx3 or Nx1x3 ('CV Grid Points' for a planar target, 'CV Points' otherwise). | |
| image_points | NPARRAY | The matching 2D image points, Nx2 or Nx1x2, in the same order as object_points. | |
| camera_matrix | NPARRAY | 3x3 intrinsic matrix K ('CV Camera Matrix' or 'Calibrate Camera'). | |
| solver | COMBO | generic - every solution the method finds | 'generic' runs the solver named below over ALL the points (4 minimum). P3P/AP3P take EXACTLY 3 or 4 points and return up to four poses - with 4 the extra point only ranks them. AP3P is the newer, numerically better-behaved formulation. |
| method | COMBO | SOLVEPNP_ITERATIVE | Which algorithm the 'generic' solver runs (ignored by P3P/AP3P). ITERATIVE returns a single refined pose; IPPE / IPPE_SQUARE are for PLANAR targets and are the ones that expose the two-fold ambiguity; SQPNP and EPNP are non-iterative alternatives. |
| dist_coeffsopt | NPARRAY | Lens distortion coefficients (k1, k2, p1, p2[, k3...]); leave unconnected for an ideal pinhole camera. |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| rvecs | NPARRAY | (N, 3) float64 stack of Rodrigues rotation vectors, one row per candidate pose. Take one with 'CV Index Batch' and feed 'CV Pose To Matrix' / cv2.projectPoints / drawFrameAxes. |
| tvecs | NPARRAY | (N, 3) float64 stack of translation vectors, in the same order (and units) as object_points. |
| reprojection_error | NPARRAY | (N, 1) float64 mean reprojection error in PIXELS for each candidate, computed the same way for every solver (cv2.projectPoints over all the points). Under ~1 px is a good fit; a large gap between the best and the second best means the ambiguity is resolved. |
| count | INT | How many candidate poses were returned (0 when not found). |
| best_index | INT | Index of the candidate with the lowest reprojection error, or -1 when not found. |
| found | BOOLEAN | — |