OpenCV recoverPose_2
Decompose an essential matrix into rotation and translation
- E
- points1
- points2
- cameraMatrix
- R
- t
- mask
- int
- nparray_1
- nparray_2
- nparray_3
recoverPose_2 is the leaner member of the pose-recovery family: instead of two full camera calibrations, you hand it an essential matrix E - the 3×3 matrix that already encodes the relative geometry between two views - plus the matched points and a single shared camera matrix, and it returns the rotation R and translation t that decomposed out of it. It's the "I already did the essential-matrix math, now give me the pose" stage, and it's the variant most people would actually reach for once they have an E from findEssentialMat (or from another tool) sitting in their graph.
The essential matrix is the neat object at the heart of epipolar geometry: it maps a point in one view to the line it must lie on in the other. Decomposing it into R and t is exactly what this node does, using the matched points to disambiguate between the four mathematically-possible camera poses and pick the one where most points are actually in front of both cameras.
Inputs that matter
E- the 3×3 essential matrix, asNPARRAY.points1,points2- matched 2D point arrays from the two views (N×2or1×N×2).cameraMatrix- the shared 3×3 intrinsics[[fx, 0, cx], [0, fy, cy], [0,0,1]]. This variant assumes both views share one camera.- Optional
R,t,mask- out-parameters; leave unplugged.
Outputs: int (number of points consistent with the chosen pose - your "how confident are we" signal), nparray_1 (R, 3×3 rotation), nparray_2 (t, 3×1 translation, scale-ambiguous), nparray_3 (inlier mask).
Practical notes
recoverPose_3 next to it is a byte-identical duplicate - the generator produced two nodes from two indistinguishable overload stubs; pick either.
The one thing to keep straight: E must be an essential matrix, not a fundamental matrix. Essential matrices assume calibrated cameras (intrinsics removed) and encode metric motion; the fundamental matrix is the uncalibrated variant and this node is not the one for that. If you feed it garbage E, you'll get confident-looking garbage R/t out - the int inlier count is your only reality check, and a low one means your inputs were bad.
And the standing caveat applies more here than anywhere in this pack: you need real matched points and real calibration for any of this to mean something. This is 3D-vision tooling that happens to live in ComfyUI, not a node that makes images prettier.
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, with the fix linked in the README.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| E | NPARRAY | — | |
| points1 | NPARRAY | — | |
| points2 | NPARRAY | — | |
| cameraMatrix | NPARRAY | — | |
| Ropt | NPARRAY | — | |
| topt | NPARRAY | — | |
| maskopt | NPARRAY | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| int | INT | — |
| nparray_1 | NPARRAY | — |
| nparray_2 | NPARRAY | — |
| nparray_3 | NPARRAY | — |