Nodes/opencv-comfyui/OpenCV convertPointsToHomogeneous_0
ComfyUI Node

OpenCV convertPointsToHomogeneous_0

ConvertPointsToHomogeneous, explained

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV convertPointsToHomogeneous_0
  • src
  • dst
  • nparray

convertPointsToHomogeneous_0 does one thing and does it cleanly: it appends a 1 as the last coordinate to every point you give it. (x, y) becomes (x, y, 1), (x, y, z) becomes (x, y, z, 1). That's the whole operation, and it's the "there are no zero-cost abstraction..." no wait - it's just the plumbing step that turns Euclidean coordinates into homogeneous coordinates so a homography or projection can do its thing.

Input is one NPARRAY (src), output is one NPARRAY with the extra column. There's an optional dst input that's an OpenCV out-parameter - the pack README's rule is don't feed it. No tunable knobs, no settings, no pictures involved. It's the forward half of the pair whose reverse is convertPointsFromHomogeneous_0 (which divides the extra coordinate back out).

This comes from opencv-comfyui, the auto-generated pack that wraps OpenCV's top-level standalone functions as ComfyUI nodes. It's one of ~600 such wrappers, and the author is upfront that many of them - this one included - don't fit ComfyUI's image-first model without extra processing. That's not a defect; it's the price of "all the functions."

Who should actually use this

Real talk: if you're doing projective geometry in ComfyUI - homography warping, stereo math, pose estimation - you already know what homogeneous coordinates are, and this node just saves you a slice. If you don't know why points would need a trailing 1, this node won't help you and no tutorial-length article will make it urgent. The author's own guidance for the pack is that these shine for small, quick image transformations, and this isn't one of those; it's raw math for the geometry corner cases.

A beginner who searched "convert points" probably wanted convertScaleAbs_0 (the contrast/brightness node) or cvtColor_0 (color conversion). Bookmark those instead.

Install and gotchas

Standard pack install:

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

Or ComfyUI Manager → opencv-comfyui → restart. No model files.

  • It's an nparray node: no IMAGE in, no IMAGE out. Image2Nparray (batch 1 only) if you start from a picture, and don't expect the output to display through Nparrays2Image - point arrays aren't images, and the pack will tell you with its classic 'NoneType' object has no attribute 'shape' error.
  • src needs to be actual points, not an image tensor - wrong shapes throw assertion errors.
  • convertPointsToHomogeneous_0 and _1 are the same node generated from the two overloads of the same function (MatLike vs UMat). Use either.
Categoryimage/OpenCV

Inputs (2)

NameTypeDefaultDescription
srcNPARRAY
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY