Nodes/opencv-comfyui/OpenCV decomposeProjectionMatrix_1
ComfyUI Node

OpenCV decomposeProjectionMatrix_1

The Twin That Splits a Camera Matrix Into Seven Outputs

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV decomposeProjectionMatrix_1
  • projMatrix
  • cameraMatrix
  • rotMatrix
  • transVect
  • rotMatrixX
  • rotMatrixY
  • rotMatrixZ
  • eulerAngles
  • nparray_0
  • nparray_1
  • nparray_2
  • nparray_3
  • nparray_4
  • nparray_5
  • nparray_6

OpenCV decomposeProjectionMatrix_1 is the overload twin of decomposeProjectionMatrix_0 - same cv2.decomposeProjectionMatrix call, same seven outputs, no difference you'll ever feel. The _1 suffix is the usual codegen artifact: geroldmeisinger/opencv-comfyui makes a node per overload in cv2's type stubs, so MatLike and UMat signatures each get one. ComfyUI can't distinguish them, so you can't go wrong.

What it's for

Camera calibration and pose math. Feed it a 3×4 projection matrix P and it decomposes into the intrinsic cameraMatrix, the world-to-camera rotMatrix and transVect, per-axis rotation matrices, and eulerAngles - i.e., "where is the camera, which way does it point, and what does the lens do." It's a niche, non-generative node that exists because the pack wraps every top-level cv2 function. Unless you're building pose/AR/3D-reconstruction pipelines inside ComfyUI, you likely won't need it.

Inputs and outputs

  • projMatrix (NPARRAY) - the 3×4 projection matrix (float matrix, not an image).
  • cameraMatrix, rotMatrix, transVect, rotMatrixX/Y/Z, eulerAngles (NPARRAY, optional) - out-parameters; leave them unconnected.
  • nparray_0 through nparray_6 (outputs) - intrinsics, rotation, translation, axis rotations, Euler angles, in order.

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. The package is opencv-contrib-python (not the README's swapped opencv-python-contrib); conflicting installs announce themselves via the guidedFilter import error, fixed as documented in the LayerStyle issue the README links.

As with the twin, all seven outputs are float matrices, not pictures - previewing them as images produces garbage or the 'NoneType' object has no attribute 'shape' error. Route them to downstream camera nodes. Full detail lives in the decomposeProjectionMatrix_0 article.

Categoryimage/OpenCV

Inputs (8)

NameTypeDefaultDescription
projMatrixNPARRAY
cameraMatrixoptNPARRAY
rotMatrixoptNPARRAY
transVectoptNPARRAY
rotMatrixXoptNPARRAY
rotMatrixYoptNPARRAY
rotMatrixZoptNPARRAY
eulerAnglesoptNPARRAY

Outputs (7)

NameTypeDescription
nparray_0NPARRAY
nparray_1NPARRAY
nparray_2NPARRAY
nparray_3NPARRAY
nparray_4NPARRAY
nparray_5NPARRAY
nparray_6NPARRAY