Nodes/opencv-comfyui/OpenCV composeRT_0
ComfyUI Node

OpenCV composeRT_0

Compose two rotations and translations (composeRT_0)

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV composeRT_0
  • rvec1
  • tvec1
  • rvec2
  • tvec2
  • rvec3
  • tvec3
  • dr3dr1
  • dr3dt1
  • dr3dr2
  • dr3dt2
  • dt3dr1
  • dt3dt1
  • dt3dr2
  • dt3dt2
  • nparray_0
  • nparray_1
  • nparray_2
  • nparray_3
  • nparray_4
  • nparray_5
  • nparray_6
  • nparray_7
  • nparray_8
  • nparray_9

This one's for the 3D-vision people. composeRT_0 wraps cv2.composeRT, which takes two rigid-body transformations - each a rotation + translation - and composes them into one. If you're doing camera calibration, pose estimation, stereo rig math, or anything where "where is the camera relative to the world" gets chained together, this is a real tool. If you're making pretty pictures, you can safely scroll past; there's nothing visual here at all.

What it does

In OpenCV, a camera pose is a rotation vector (rvec, a 3×1 Rodrigues vector - not a 3×3 matrix) plus a translation vector (tvec, 3×1). Compose two of them, and the result is:

  • rvec3 - R = R1 * R2 (rotate by 2, then by 1)
  • tvec3 - t = R1 * t2 + t1

Think of it as matrix multiplication for poses: if (rvec1, tvec1) moves you from frame A to B and (rvec2, tvec2) from B to C, the composed pair moves you straight from A to C. That's the whole point of the node.

The inputs and outputs

  • rvec1 / rvec2 (NPARRAY) - rotation vectors (3×1 each).
  • tvec1 / tvec2 (NPARRAY) - translation vectors (3×1 each).
  • The eight optional dr3…/dt3… inputs - these are Jacobian out-parameters (how the result changes as each input nudges), used for error propagation in calibration. The README says to skip the optional out-params, and for a beginner that's exactly right. Leave them alone.

Outputs - all ten of them: nparray_0 (rvec3), nparray_1 (tvec3), then eight derivative matrices (nparray_2 through nparray_9). For most work you only care about the first two; the derivatives are there because calibration code needs them. There's no named output for "the composed pose" - it's nparray_0 and nparray_1, and that's your answer.

When this shows up in a real workflow

Honestly, composeRT_0 is about as deep into computer-vision math as this pack goes. The realistic scenario is a 3D-reconstruction or pose pipeline: you've estimated camera extrinsics with solvePnP (also in the pack), you want to chain relative poses into an absolute trajectory, and you reach for this. In pure ComfyUI image-gen land it's rare - but if you're experimenting with novel-view synthesis or camera-rig math, having it wired in beats leaving your graph to run Python on the side.

Install and gotchas

Same pack as everything else: ComfyUI Manager (search "opencv-comfyui") or

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui

Requires opencv-python-contrib. The practical gotchas: rotation vectors must be Rodrigues vectors, not 3×3 matrices (a shape mismatch will surface as a cryptic assertion); and these are pure nparray inputs, so if you're feeding data in from an image pipeline, convert with Image2Nparray first - though realistically your rvec/tvec will come from other math nodes, not from images at all.

Categoryimage/OpenCV

Inputs (14)

NameTypeDefaultDescription
rvec1NPARRAY
tvec1NPARRAY
rvec2NPARRAY
tvec2NPARRAY
rvec3optNPARRAY
tvec3optNPARRAY
dr3dr1optNPARRAY
dr3dt1optNPARRAY
dr3dr2optNPARRAY
dr3dt2optNPARRAY
dt3dr1optNPARRAY
dt3dt1optNPARRAY
dt3dr2optNPARRAY
dt3dt2optNPARRAY

Outputs (10)

NameTypeDescription
nparray_0NPARRAY
nparray_1NPARRAY
nparray_2NPARRAY
nparray_3NPARRAY
nparray_4NPARRAY
nparray_5NPARRAY
nparray_6NPARRAY
nparray_7NPARRAY
nparray_8NPARRAY
nparray_9NPARRAY