Nodes/opencv-comfyui/OpenCV convertPointsFromHomogeneous_0
ComfyUI Node

OpenCV convertPointsFromHomogeneous_0

The projective-geometry errand

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

This is the node you search for when a homography or projection result comes back as homogeneous coordinates and you need actual 2D or 3D points out of it. convertPointsFromHomogeneous_0 divides every point by its last coordinate: (x, y, z, w) becomes (x/w, y/w, z/w), and (x, y, w) becomes (x/w, y/w). It's the inverse of convertPointsToHomogeneous_0 - that one appends a 1, this one divides it away.

In plain terms: projective geometry (camera work, homographies, stereo, pose estimation) routinely represents points in homogeneous form, and the moment you want to feed those points into anything that expects Euclidean coordinates, you run them through this. The input is a single NPARRAY (src) of points - shape like (N, 3) for 3D homogeneous points or (N, 4) for 4-vector projective points - and the output is the same NPARRAY with the last column divided out. There's an optional dst input, another OpenCV out-parameter that the pack README tells you to skip.

It's part of opencv-comfyui, the auto-generated pack wrapping OpenCV's top-level functions. This is a pure-math node: no pixels touched, nothing viewable, nothing to tune. It exists because the pack promised "all top-level standalone functions," and a promise is a promise.

Where this actually shows up

Honestly? Rarely, in a ComfyUI context. The author's own take on the pack is that these nodes shine for small, quick transformations - blurs, edge detectors, thresholding - and "full-blown OpenCV apps" like camera-calibration math are still better in a Python script. If you're doing serious homography work inside ComfyUI you're already a power user, and this node just saves you the src[..., :-1] / src[..., -1:] slicing you'd otherwise type into a Python node.

If you're a beginner who landed here from a search: this is almost certainly not the node you need. It won't modify an image, it produces no picture, and Nparrays2Image will throw the pack's classic 'NoneType' object has no attribute 'shape' at you if you try to display the result. Your search was probably for cvtColor_0 (color conversion) or convertScaleAbs_0 (contrast/brightness).

Install and gotchas

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

Or ComfyUI Manager → opencv-comfyui, restart, done. No models.

  • Feed it nparrays, not IMAGE tensors - Image2Nparray in (batch 1 only) if you must start from an image, though for pure point math you'd usually wire in nparray output from other geometry nodes.
  • src must actually be homogeneous points; feeding a plain image means assertion errors about shape.
  • convertPointsFromHomogeneous_0 and _1 are identical - the MatLike/UMat overload pair from the type definitions. Either works.
Categoryimage/OpenCV

Inputs (2)

NameTypeDefaultDescription
srcNPARRAY
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY