OpenCV decomposeEssentialMat_0
Extracting Camera Motion From an Essential Matrix
- E
- R1
- R2
- t
- nparray_0
- nparray_1
- nparray_2
OpenCV decomposeEssentialMat_0 is a camera-geometry node. It takes an essential matrix E - a 3×3 matrix that relates two views of the same scene by their epipolar constraint - and decomposes it into the two possible camera rotations and the translation between the cameras. This is structure-from-motion / stereo-reconstruction territory: the kind of math that turns "I have two photos of the same thing" into "the camera moved this much, this way."
Straight up: this node is not for the 99% of ComfyUI users doing diffusion. There is no image generation anywhere in it. It's here because geroldmeisinger/opencv-comfyui auto-generates a node for every top-level cv2 function, and cv2.decomposeEssentialMat happened to be one of them. If you're building pose-estimation or 3D-reconstruction pipelines on top of ComfyUI - say, feeding keypoint detections into a camera solver - this is exactly the piece you'd reach for.
How it works
The essential matrix encodes how a point in one camera's image constrains where it can appear in the other's. decomposeEssentialMat factorizes E into the two rotation candidates (R1, R2) and one translation direction (t), because from the matrix alone you can't tell which rotation is real - you'd normally resolve the ambiguity by checking which combination puts reconstructed 3D points in front of both cameras. That's a downstream step this node doesn't do.
The inputs here are matrices, not images. E should be a 3×3 float nparray, typically produced by cv2.findEssentialMat (also wrapped in this pack as findEssentialMat_0). Don't feed it a picture - this is one of the pack's "nparray" nodes where the README's warning that "not every return type is actually an image" applies in reverse: the input isn't an image either.
Inputs and outputs
E(NPARRAY) - the 3×3 essential matrix.R1,R2,t(NPARRAY, optional) - out-parameters; leave unconnected.nparray_0(output) - first rotation candidate, 3×3.nparray_1(output) - second rotation candidate, 3×3.nparray_2(output) - translation direction, 3×1.
The optional inputs are OpenCV's out-parameters (the function fills them), and the outputs are the results. decomposeEssentialMat_1 is the identical MatLike/UMat twin.
Install
ComfyUI Manager (search opencv-comfyui) or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-contrib-python
Restart ComfyUI. No models. Use opencv-contrib-python (the README's opencv-python-contrib is the wrong package name). If you see Cannot import name 'guidedFilter' from 'cv2.ximgproc', that's conflicting OpenCV installs; the README links the known fix.
The trap
Everything this node emits is a float matrix, and ComfyUI's preview pipeline will happily try to show it as a picture - you'll get garbage or the 'NoneType' object has no attribute 'shape' error from Nparrays2Image. These outputs are data for other camera nodes (cv2.triangulatePoints, solvePnP, etc.), not images. If you want to visualize the rotation, extract Euler angles and format them yourself.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| E | NPARRAY | — | |
| R1opt | NPARRAY | — | |
| R2opt | NPARRAY | — | |
| topt | NPARRAY | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| nparray_0 | NPARRAY | — |
| nparray_1 | NPARRAY | — |
| nparray_2 | NPARRAY | — |