Nodes/comfyui_cv/CV Detect Blobs
ComfyUI Node

CV Detect Blobs

cv2.SimpleBlobDetector: finds compact bright-or-dark spots by thresholding the image at many levels and keeping the regions that stay stable across them, then filtering by SHAPE. That shape filtering is what a threshold + findContours chain does not give you: area, circularity (how round), convexity (how dented) and inertia ratio (how elongated) in one pass. Classic uses: counting cells, dots, holes, bubbles or calibration targets. SimpleBlobDetector is a cv2 class the raw wrappers cannot expose. It produces no descriptors - run 'CV Compute Descriptors' if the blobs must be matched. Finding nothing is a valid result (count = 0).

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Detect Blobs
  • image
  • keypoints
  • points
  • sizes
  • responses
  • count
blob_colordark blobs on a light background
min_area25
max_area5000
min_circularity0.00
min_convexity0.00
min_inertia0.00
min_threshold50
max_threshold220
threshold_step10
min_repeatability2
min_distance10
Categoryimage/CV/features

Inputs (12)

NameTypeDefaultDescription
imageNPARRAY,IMAGEImage to search (converted to grayscale internally). 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.
blob_colorCOMBOdark blobs on a light backgroundPolarity of the blobs. Pick the wrong one and the detector returns nothing - this is the first thing to flip when count is 0.
min_areaFLOAT250–10000000Smallest blob area in PIXELS. 0 disables the lower bound. Raise it to ignore speckle noise.
max_areaFLOAT50000–10000000Largest blob area in pixels. 0 means NO upper limit (the area filter is then one-sided).
min_circularityFLOAT0.000–1Minimum 4*pi*area / perimeter^2: 1.0 is a perfect circle, ~0.79 a square. 0 disables the filter.
min_convexityFLOAT0.000–1Minimum area / convex-hull area: 1.0 is fully convex, lower values allow dents and crescents. 0 disables the filter.
min_inertiaFLOAT0.000–1Minimum inertia ratio (short axis / long axis): 1.0 is a circle, near 0 is a thin streak. 0 disables the filter - raise it to reject elongated smears.
min_thresholdoptFLOAT500–255First grayscale threshold of the sweep.
max_thresholdoptFLOAT2200–255Last grayscale threshold of the sweep.
threshold_stepoptFLOAT101–128Step between successive thresholds; smaller is more thorough and slower.
min_repeatabilityoptINT21–100A blob must appear at this many consecutive thresholds to be reported - the stability test.
min_distanceoptFLOAT100–10000Blobs closer together than this (pixels) are merged into one.

Outputs (5)

NameTypeDescription
keypointsCV_KEYPOINTScv2.KeyPoint list - draw with 'CV Draw Keypoints', or give them descriptors with 'CV Compute Descriptors' to feed 'CV Match Features'.
pointsNPARRAYNx2 float32 (x, y) centres - the point-set form for 'OpenCV Draw Points', k-means, polar conversion, ...
sizesNPARRAY(N,) float32 keypoint diameter in pixels.
responsesNPARRAY(N,) float32 detector strength per keypoint - threshold it to keep only the strong ones.
countINTHow many were found; 0 is a valid result, not an error.