Nodes/ComfyUI CV/CV Draw Keypoints
ComfyUI Node

CV Draw Keypoints

The two-line sanity check for any feature detector

By bmad4ever·Created 3 months ago·Updated 14 days ago· 1
CV Draw Keypoints
  • source
  • keypoints
  • image
◄styleplain►

Why you'd reach for this

SIFT, ORB, BRISK, AKAZE, KAZE - the detector is a dropdown in CV Detect Features, and the answer to "which one, and with what thresholds" is almost always "look at where the points landed." A keypoint set that clusters on the texture and ignores the flat sky is what you want; one that's sprayed evenly across the frame including the smooth regions is a detector finding noise.

This is the smallest node in the pack's visualization family, and it's the one you'll run most often.

How it works

It's cv2.drawKeypoints with the pack's usual polymorphic source - IMAGE, MASK or NPARRAY, output in the same format as the input, so a MASK pipeline keeps its single channel.

style picks between two genuinely different renderings, and it's the only input besides the source and the keypoints:

  • plain - small dots. Fast to read, tells you where.
  • rich - circles sized by each keypoint's scale with an orientation tick. Tells you at what size and angle the detector saw that feature, which is what you need when matches are going wrong: two keypoints with wildly different scales are a bad match candidate even if their descriptors agree.

That's the cv2 rich-keypoints flag doing the work, not something hand-rolled. The drawing colour is fixed green, which is fine against most photographs and hopeless against foliage or grass - worth knowing before you conclude the node drew nothing. If you need a controllable colour, the sibling node CV DrawMatches takes one.

There's no count output here; if you want the number of keypoints, that's CV Detect Features' own output - or the fact that an empty set simply draws nothing, which is a valid "nothing detected" result and not an error.

Inputs and outputs that matter

  • source - the image you detected on. Draw at the same resolution, not a resized copy.
  • keypoints - a CV_KEYPOINTS value, i.e. straight off CV Detect Features. It's a typed socket, not an array: the keypoint objects carry position, scale, angle and response, and CV Filter Keypoints, CV Compute Descriptors and CV Match Features all speak that type. The pack also has CV Contour To Points-style bridges between its array and contour worlds, but keypoints have their own type for a reason - the scale and angle would be lost in a bare Nx2.
  • style - plain for a quick look, rich when diagnosing scale or orientation problems.
  • image - the only output; feed a Preview or Save node.

The usual graph is: image → CV Detect Features → CV Draw Keypoints for the look, and the same keypoints fanned out to CV Filter Keypoints → CV Match Features for the actual work. Drawing is a branch you can delete; it shouldn't be in the path that feeds the matcher.

Install

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, ComfyUI on the V3 node API, or install ComfyUI CV through ComfyUI Manager. Feature detection and its rendering are classic cv2 on the CPU - no model, no VRAM.

Common issues

  • Keypoints invisible. Green on green. Also check you're drawing on the same image, at the same size, that the detector saw.
  • Thousands of points, all in the noise. Detector thresholds too loose. That's an upstream problem this node is meant to reveal; add CV Filter Keypoints to keep a robust subset by response, size or count.
  • Rich mode circles enormous. Keypoint scale can be large; that's real information. A detector configured for huge scales will find few, fat features.
  • Keypoint type mismatch. CV Detect Features output is a CV_KEYPOINTS socket - don't try to feed it a plain array from somewhere else, and don't expect to hand these keypoints to a bbox or point node. CV Compute Descriptors, CV Match Features and this node are the consumers.
  • Contrib build. Needs the contrib wheel; installing a plain opencv-python over it empties the contrib submodules and takes contrib nodes with it. tools/repair_opencv_contrib.py --check / --apply.
Categoryimage/CV/features

Inputs (3)

NameTypeDefaultDescription
sourceCOMFY_MATCHTYPE_V3Image or mask to draw the keypoints on (a copy is made). Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size.
keypointsCV_KEYPOINTSKeypoints to draw (from 'CV Detect Features').
styleCOMBOplainplain: small dots. rich: circles sized by scale with an orientation tick.

Outputs (1)

NameTypeDescription
imageCOMFY_MATCHTYPE_V3Same format as the image input.