OpenCV recoverPose_6
Recover pose AND the 3D points behind your matches
- E
- points1
- points2
- cameraMatrix
- R
- t
- mask
- triangulatedPoints
- int
- nparray_1
- nparray_2
- nparray_3
- nparray_4
recoverPose_6 is the most complete member of the pose-recovery family: it not only decomposes an essential matrix E into rotation R and translation t, it also triangulates the matched points into 3D coordinates and gives you those back as triangulatedPoints. That extra output is what turns "camera moved like this" into "and here's the actual 3D point cloud of what you were looking at" - the difference between recovering pose and doing a sliver of genuine 3D reconstruction.
The mechanism: given E, matched 2D points, and a shared camera matrix, OpenCV first recovers the camera pose, then shoots rays from each camera through the matched points and finds where they intersect in space. Because matched 2D points can correspond to things arbitrarily close or arbitrarily far, the variant adds a distanceThresh (in world units): any triangulated point closer than that threshold to a camera is considered geometrically invalid and dropped from the pose estimate. That's the "cheirality + near-point rejection" filter that makes the result robust instead of just optimistic.
Inputs
E- 3×3 essential matrix (NPARRAY).points1,points2- matched 2D points from the two views (N×2or1×N×2).cameraMatrix- shared 3×3 intrinsics[[fx,0,cx],[0,fy,cy],[0,0,1]].distanceThresh- float, in world units. Points triangulated closer than this to a camera get rejected. The value's meaning depends entirely on the units your scene is in, so pick it to match your data.- Optional
R,t,mask,triangulatedPoints- out-parameters; leave them unplugged.
Outputs: int (number of surviving consistent points), nparray_1 (R), nparray_2 (t), nparray_3 (inlier mask), nparray_4 (triangulatedPoints - the recovered 3D coordinates).
Notes
recoverPose_7 next to it is a byte-identical duplicate - the auto-generator couldn't tell the overload stubs apart, so you get two copies. Use either.
The triangulated points only mean something if the rest of your pipeline is real: genuine matches, a true essential matrix, and a distanceThresh scaled to your world. Feeding synthetic or hand-waved numbers in produces a confident-looking point cloud that doesn't correspond to anything. The int output and the count of non-masked points are your reality checks.
If you're coming from image generation, one more time: this is not that. It's 3D-vision math wrapped as a node, useful for reconstruction/calibration experiments and nothing you'd chain into a diffusion pipeline.
Install
No models, no downloads - OpenCV is the only real dependency:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-contrib-python
Or search "OpenCV" in ComfyUI Manager, restart, browse image/OpenCV. batch_size==1 only; a guidedFilter import error at load means conflicting OpenCV packages, fix linked in the README.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| E | NPARRAY | — | |
| points1 | NPARRAY | — | |
| points2 | NPARRAY | — | |
| cameraMatrix | NPARRAY | — | |
| distanceThresh | FLOAT | — | |
| Ropt | NPARRAY | — | |
| topt | NPARRAY | — | |
| maskopt | NPARRAY | — | |
| triangulatedPointsopt | NPARRAY | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| int | INT | — |
| nparray_1 | NPARRAY | — |
| nparray_2 | NPARRAY | — |
| nparray_3 | NPARRAY | — |
| nparray_4 | NPARRAY | — |