OpenCV Rodrigues_0
Flip a 3D rotation between vector and matrix mid-workflow
- src
- dst
- jacobian
- nparray_0
- nparray_1
Rodrigues_0 wraps cv2.Rodrigues, and if that name means nothing to you, here's the one-line version: it converts a 3D rotation written as a 3-element vector into a 3×3 rotation matrix, and the other way around. Anyone who has touched camera pose, solvePnP, or AR projection has seen this call in every Python script - it's the glue that connects "compact rotation" to "matrix you can multiply." This node is that call, exposed in ComfyUI.
When to reach for it
You'll reach for it in the rare workflow that actually does geometry: reconstructing a camera's orientation, converting a rotation vector that some pose-estimation math handed you into a matrix for a warp or projection step, or prepping a rotation for anything downstream that wants SO(3) form. It's not a pixel node. It doesn't make images prettier. It's math plumbing, and if your pipeline never touches 3D you will never use it - that's fine, it's not for you. But if you're doing the depth-map-to-3D, multi-view pose, or camera-reconstruction stuff the KB covers under depth estimation, this is exactly the kind of step that keeps popping up in the middle of the graph.
How it works
Mechanically it's Rodrigues' rotation formula. A rotation vector encodes the rotation as axis + angle: the vector's direction is the axis, its length is the angle in radians. The 3×3 matrix is the equivalent rotation. One call gets you both the converted form and a jacobian (the derivative matrix, useful if you're doing optimization but safe to ignore here).
Inputs and outputs
Inputs that matter: src (NPARRAY, required) is a 3×1 (or 1×3) rotation vector and you get a 3×3 matrix out, or feed a 3×3 matrix and get a 3×1 vector out. The dst and jacobian inputs are optional out-parameters - the README flatly tells you to avoid those, so leave them unwired and let OpenCV allocate. Outputs are nparray_0 (the converted rotation) and nparray_1 (the jacobian). Wire nparray_0 onward and forget the rest.
Troubleshooting
The gotcha is the one every auto-generated OpenCV wrapper shares: the pack deals in raw NPARRAYs, not Comfy IMAGEs. Feed Rodrigues a converted image and you'll get an assertion error or, worse, a matrix that isn't a picture - run it through Nparrays2Image and you get the classic 'NoneType' object has no attribute 'shape' because the result was never an image. And src must be genuinely 3-vector or 3×3 shaped; sloppy shapes are the fastest way to a cv2 error here. The _0/_1 naming is just the pack numbering the MatLike and UMat overloads - from the UI they're interchangeable, so don't sweat which you grabbed.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-contrib-python
Install via ComfyUI Manager (search "opencv-comfyui") or the commands above. The pack's only real dependency is OpenCV itself - pip install opencv-contrib-python (what its requirements.txt actually declares; the README spells it differently). No model downloads, no weights, pure computation.
Honest verdict: niche, ugly to look at, and there are no threads about it because almost nobody runs classical computer-vision math inside ComfyUI. But when your workflow needs a rotation matrix, it beats exporting to a Python script.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| src | NPARRAY | — | |
| dstopt | NPARRAY | — | |
| jacobianopt | NPARRAY | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| nparray_0 | NPARRAY | — |
| nparray_1 | NPARRAY | — |