ComfyUI Node

Circle Pattern Processor

Find circles in anything — no model, no API key, just OpenCV

By mr7thing·Created about a year ago·Updated about a year ago· 0
Circle Pattern Processor
  • image
  • IMAGE
  • CIRCLES
min_radius5
max_radius20
output_circle_size10
edge_detection_sensitivity50
circle_accumulator_threshold30
min_center_dist10
merge_modekeep_first

Circle Pattern Processor is the headline node of the tiny mr7thing/circle_pattern_processor pack. Feed it an image and it finds every circle in it - pills on a tray, washers in a bin, dot patterns on a scan - then hands you both a cleaned-up image of those circles and the raw coordinates.

Here's the part that makes it worth a look: it doesn't use a model at all. It's a classic computer-vision algorithm, OpenCV's Hough transform, wrapped up as a node. No checkpoint to download, no VRAM pressure, no hallucinated geometry. Everyone reaches for SAM or segmentation when they want to pull objects out of an image, and that's overkill for a job that's literally "find the circles." A Hough transform is deterministic and free, and it won't invent a circle that isn't there.

How it works

The pipeline, straight from the source:

  1. Your image gets converted to grayscale.
  2. OpenCV's HoughCircles with the HOUGH_GRADIENT variant scans for circular edges in the radius range you set.
  3. Nearby centers get merged - that's min_center_dist and merge_mode doing the work.
  4. The node draws every accepted circle as a uniform white disc on a black canvas at output_circle_size (not the detected radius), and returns that image plus a tuple of (x, y, r) per circle.

The inputs that matter

You'll actually touch four of these:

  • min_radius / max_radius (default 5 / 20) - the detection radius range in pixels. If you're finding nothing, your circles are probably outside this window.
  • circle_accumulator_threshold (default 30) - the "how many votes before a circle counts" knob. Lower it to detect more (and get more false positives); raise it to be stricter.
  • edge_detection_sensitivity (default 50) - feeds OpenCV's Canny edge detector. Higher means stricter edges.
  • min_center_dist + merge_mode - two circles whose centers sit closer than min_center_dist get combined. keep_first keeps the first one found; use_average blends them into a mean center and radius.

Outputs

  • IMAGE - the black canvas with standardized white circles. Preview it, save it, or feed it onward.
  • CIRCLES - a tuple of (x, y, r) coordinates, which is exactly what the pack's SVG exporter eats.

Install

ComfyUI Manager: search for "Circle Pattern Processor" and hit install. Or the manual route:

cd ComfyUI/custom_nodes
git clone https://github.com/mr7thing/circle_pattern_processor
cd circle_pattern_processor
pip install -r requirements.txt

Restart ComfyUI. The requirements are just numpy, opencv-python, and Pillow - no models, no API keys, nothing to download beyond the repo. The node lives under image/pattern in the menu.

Common issues

  • Detects nothing - widen the radius range first, then lower circle_accumulator_threshold. That's the order that fixes most cases.
  • Too many spurious circles - raise the accumulator threshold, and bump min_radius so near-duplicate centers collapse.
  • One honest caveat from reading the code: the Hough call's internal minDist is wired to min_radius, not min_center_dist, so those two don't do quite what the names imply. If center separation is your problem, nudge min_radius.
  • The node processes only the first frame of a batch and demands 3-channel RGB input, so feed it a single image, not a video stream.

It's a small, lightly-maintained pack from a single author, so there's no big community around it - but for "count the circles and get the coordinates," it's about the simplest thing in the ecosystem that actually works.

Categoryimage/pattern

Inputs (8)

NameTypeDefaultDescription
imageIMAGE
min_radiusFLOAT51–100
max_radiusFLOAT201–100
output_circle_sizeFLOAT101–50
edge_detection_sensitivityFLOAT501–100
circle_accumulator_thresholdFLOAT301–100
min_center_distFLOAT101–100
merge_modeCOMBOkeep_first2 options: keep_first, use_average

Outputs (2)

NameTypeDescription
IMAGEIMAGE
CIRCLESTUPLE