Circle Pattern Processor
Find circles in anything — no model, no API key, just OpenCV
- image
- IMAGE
- CIRCLES
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:
- Your image gets converted to grayscale.
- OpenCV's
HoughCircleswith theHOUGH_GRADIENTvariant scans for circular edges in the radius range you set. - Nearby centers get merged - that's
min_center_distandmerge_modedoing the work. - 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_distget combined.keep_firstkeeps the first one found;use_averageblends 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_radiusso near-duplicate centers collapse. - One honest caveat from reading the code: the Hough call's internal
minDistis wired tomin_radius, notmin_center_dist, so those two don't do quite what the names imply. If center separation is your problem, nudgemin_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.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| min_radius | FLOAT | 51–100 | — |
| max_radius | FLOAT | 201–100 | — |
| output_circle_size | FLOAT | 101–50 | — |
| edge_detection_sensitivity | FLOAT | 501–100 | — |
| circle_accumulator_threshold | FLOAT | 301–100 | — |
| min_center_dist | FLOAT | 101–100 | — |
| merge_mode | COMBO | keep_first | 2 options: keep_first, use_average |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| CIRCLES | TUPLE | — |