Nodes/opencv-comfyui/OpenCV drawFrameAxes_1
ComfyUI Node

OpenCV drawFrameAxes_1

DrawFrameAxes, take two — same pose, same axes, no difference

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV drawFrameAxes_1
  • image
  • cameraMatrix
  • distCoeffs
  • rvec
  • tvec
  • nparray
length
thickness

Here's the whole story of drawFrameAxes_1 in one paragraph: it's the second overload of the same function as drawFrameAxes_0, and they behave identically. OpenCV declares most functions twice - once accepting a cv2.typing.MatLike image, once accepting a cv2.UMat - and the opencv-comfyui generator emits a numbered node for every signature it finds in the type stubs. So _0 and _1 are two doors to the same room. Pick one and stop second-guessing.

The useful part

What the node does is genuinely handy if you're doing camera-pose estimation in ComfyUI: it draws the detected object's 3D coordinate frame onto a photo - red X, green Y, blue Z - given the camera's intrinsics and the rvec/tvec pose from solvePnP. It's the visual check that turns "the rotation matrix says the checkerboard is tilted 20 degrees" into something you can see is actually correct.

The inputs to get right:

  • cameraMatrix - 3x3 intrinsics as an NPARRAY. This is the one that breaks most often; a transposed or wrong cx/cy makes the axes land somewhere nonsensical.
  • distCoeffs - distortion coefficients; [[0, 0, 0, 0, 0]] for an idealized lens.
  • rvec, tvec - the pose from solvePnP.
  • length - axis length in the 3D model's units. This one is a trap: it's relative to your model, so you'll tune it by eye the first time.
  • thickness - pixels, plain and simple.

image is the frame, and the single nparray output is the annotated frame.

Install and the house rules

Same pack as everything else here: opencv-comfyui. ComfyUI Manager → search OpenCV, or:

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-python-contrib

Restart, and you're in. requirements.txt is opencv-contrib-python, numpy, torch.

The recurring house rules apply: images enter through Image2Nparray (RGB→BGR) and leave through Nparrays2Image, only batch_size==1 is supported, and any literal field must be valid Python syntax or you'll get the pack's trademark invalid syntax (<unknown>, line 0). There's no way around any of that with this node - it's an NPARRAY-in/NPARRAY-out cv2 call, full stop.

Verdict: identical twin to _0; useful exactly as often as your pose-estimation workflow is. If that's never, you've lost nothing by knowing about it.

Categoryimage/OpenCV

Inputs (7)

NameTypeDefaultDescription
imageNPARRAY
cameraMatrixNPARRAY
distCoeffsNPARRAY
rvecNPARRAY
tvecNPARRAY
lengthFLOAT
thicknessINT

Outputs (1)

NameTypeDescription
nparrayNPARRAY