OpenCV solvePnP_1
SolvePnP_1 — the same pose solver, from the duplicate overload
- objectPoints
- imagePoints
- cameraMatrix
- distCoeffs
- rvec
- tvec
- bool
- nparray_1
- nparray_2
Quick answer so you don't waste the afternoon: solvePnP_1 and solvePnP_0 are the same node. The opencv-comfyui pack parses OpenCV's type stubs and generates one node per overload, and cv2.solvePnP's (objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess, flags) signature is declared twice in slightly different forms - so you get a _0 and a _1 with identical schemas and identical behavior. Display name "OpenCV solvePnP_1" versus "OpenCV solvePnP_0" is the entire difference.
For the full explanation of PnP - what it solves, how to set up the camera matrix, which flags value to start with - read the solvePnP_0 article. This page is the short version: use either node.
What it takes
The inputs, unchanged:
- objectPoints (NPARRAY) - known 3D points, N×3.
- imagePoints (NPARRAY) - their 2D projections, N×2.
- cameraMatrix (NPARRAY) - 3×3 intrinsic matrix.
- distCoeffs (NPARRAY) - distortion coefficients; zeros means none.
- useExtrinsicGuess (BOOLEAN) -
falseunless you're refining a known pose. - flags (INT) - OpenCV solver enum;
0(ITERATIVE) is the safe start. - rvec / tvec (optional NPARRAY) - out-parameters / initial guesses.
Outputs: bool (success - check it), nparray_1 (rvec), nparray_2 (tvec).
Why the numbering exists at all
The pack's README explains the whole design: functions are extracted from cv2/__init__.pyi with ast.parse(), "most functions are overloaded and they were numbered." When OpenCV declares the same overload twice (which it does - the .pyi often lists the MatLike and UMat variants separately, plus near-identical re-statements), the generator doesn't deduplicate. You get _0 and _1 that are twins. It's not a bug, it's the cost of automation, and it's the same story across solvePnPRefineLM, sort, sortIdx and friends in this pack.
So there is no "which one is better" decision here. Grab whichever ComfyUI's search bar offers first and move on.
The practical bits still apply
Everything about wiring is pack-standard: this node eats and spits NPARRAY, not IMAGE. Convert with Image2Nparray in, Nparrays2Image out, keep batch size at 1, and remember the cvtColor codes from the README (6 = BGR2GRAY, 8 = GRAY2BGR) if you hit a CV_8UC1 assertion error.
Install
One pack, one install:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-contrib-python
(Or ComfyUI Manager → "opencv-comfyui"). Restart. Dependencies: opencv-contrib-python, numpy, torch - no downloads.
Troubleshooting
booloutputFalse→ pose solve failed; check point counts and the camera matrix.- NaNs in rvec/tvec → degenerate 3D points or a bad
flags; try0. guidedFilterimport error at startup → conflicting OpenCV packages; README links the fix.
One node, two names. If you understand solvePnP_0, you understand this one completely.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| objectPoints | NPARRAY | — | |
| imagePoints | NPARRAY | — | |
| cameraMatrix | NPARRAY | — | |
| distCoeffs | NPARRAY | — | |
| useExtrinsicGuess | BOOLEAN | — | |
| flags | INT | — | |
| rvecopt | NPARRAY | — | |
| tvecopt | NPARRAY | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| bool | BOOLEAN | — |
| nparray_1 | NPARRAY | — |
| nparray_2 | NPARRAY | — |