Nodes/ComfyUI CV/CV Scale Points
ComfyUI Node

CV Scale Points

Multiplying keypoints by a number, and why you keep needing to

By bmad4ever·Created 4 months ago·Updated 15 days ago· 1
CV Scale Points
  • points
  • points
◄scale1.00►

This is the smallest useful node in the pack: points * scale. That's it. And yet the number of times you need it in a real computer-vision graph is annoying - because detection happens at one resolution and everything downstream happens at another.

What it's for

Three recurring situations. First, you detected features on a downscaled copy and now need them on the original - scale by 1/S (or S, depending on which way you downscaled; the node doesn't guess, which is the point). Second, you have points in a padded space because the DNN wanted a multiple of 32, and you need them back in unpadded pixel space. Third, you're moving keypoints, centroids or a detection table into the coordinate space of a crop or a warp.

Numpy-level simplicity is the right design here. A node that "helpfully" infers the scale from image sizes is a node that's wrong in ways you can't see; you'd rather state the factor and verify it.

What you actually set

Two required inputs:

  • points - an Nx1x2 or Nx2 array, or None/empty. The tooltip's None-and-empty handling is the reason this node is pleasant in a CV Find Contours → filter → measure chain: when the upstream finds nothing, you get an empty array out, not an exception that kills the whole run. That's a deliberate house style across this pack - plenty of its nodes return found=false instead of raising.
  • scale - one FLOAT, default 1, range -1000000 to 1000000. Every coordinate is multiplied by it. Above 1 enlarges; below 1 shrinks.

Note what's missing: there's no separate x and y scale. Both axes move together. If your source and destination differ in aspect ratio - a non-uniform resize, or a latent mapped to a non-multiple-of-8 image - a single factor is the wrong tool and you should reach for CV Scale BBoxes (which reads a real target height and width) or scale x and y as separate chains.

One output: points, NPARRAY, same type in and out.

In a graph

Wire the scaled points into CV Draw Points to check them, or into CV Sample Array At Points / CV Filter Points By Mask for actual work. If you also scaled boxes or homographies in the same pipeline, the factor you used here should match the one you passed to CV Scale BBoxes - that's three nodes with one shared mental model, and keeping them consistent is the whole game.

Install

ComfyUI Manager → ComfyUI CV → install → restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_cv
pip install "opencv-contrib-python-headless~=5.0.0.93"

Python ≥ 3.12, recent ComfyUI on the V3 node API. Nothing to download.

Common issues

  • Points land at half or double. You used the wrong direction of the factor. scale is applied directly to the coordinates, so a 4× downscale means scale = 4 to get back to the original - not 0.25. Sanity-check with one known point.
  • Everything is in the negative range. A negative scale mirrors the coordinate space, which is occasionally what you want (flipping an axis after a cv2.flip) and usually a typo.
  • Points are fine but the Nx1x2 shape disagrees with a consumer. This is what CV Reshape Array is for; the pack's point nodes accept Nx2 and Nx1x2 but not every third-party node is that relaxed.
  • The whole image/CV category is missing after a pip install. Something pulled in a non-contrib OpenCV wheel and wiped the contrib submodules in the shared site-packages/cv2. tools/repair_opencv_contrib.py --check then --apply.
Categoryimage/CV/points

Inputs (2)

NameTypeDefaultDescription
pointsNPARRAYNx1x2 or Nx2 point array (or None/empty).
scaleFLOAT1.00-1000000–1000000Scale factor applied to every coordinate. >1 enlarges, <1 shrinks.

Outputs (1)

NameTypeDescription
pointsNPARRAY—