Nodes/comfyui_cv/cv2.HoughCircles
ComfyUI Node

cv2.HoughCircles

Raw wrapper of cv2.HoughCircles(image, method, dp, minDist, param1?, param2?, minRadius?, maxRadius?). Parameters marked '?' are optional; blank means OpenCV default. See the OpenCV documentation for details.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
cv2.HoughCircles
  • image
  • nparray
methodHOUGH_GRADIENT
dp0.0000
minDist0.0000
param1100.0000
param2100.0000
minRadius0
maxRadius0
Categoryimage/CV/low-level/cv2 H

Inputs (8)

NameTypeDefaultDescription
imageNPARRAY,IMAGE,MASK8-bit, single-channel, grayscale input image. 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.
methodCOMBOHOUGH_GRADIENTDetection method, see #HoughModes. The available methods are #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT.
dpFLOAT0.0000-1e+38–1e+38Inverse ratio of the accumulator resolution to the image resolution. For example, if dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has half as big width and height. For #HOUGH_GRADIENT_ALT the recommended value is dp=1.5, unless some small very circles need to be detected.
minDistFLOAT0.0000-1e+38–1e+38Minimum distance between the centers of the detected circles. If the parameter is too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is too large, some circles may be missed.
param1optFLOAT100.0000-1e+38–1e+38First method-specific parameter. In case of #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT, it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller). Note that #HOUGH_GRADIENT_ALT uses #Scharr algorithm to compute image derivatives, so the threshold value should normally be higher, such as 300 or normally exposed and contrasty images. Preset to the OpenCV default (100.0).
param2optFLOAT100.0000-1e+38–1e+38Second method-specific parameter. In case of #HOUGH_GRADIENT, it is the accumulator threshold for the circle centers at the detection stage. The smaller it is, the more false circles may be detected. Circles, corresponding to the larger accumulator values, will be returned first. In the case of #HOUGH_GRADIENT_ALT algorithm, this is the circle "perfectness" measure. The closer it to 1, the better shaped circles algorithm selects. In most cases 0.9 should be fine. If you want get better detection of small circles, you may decrease it to 0.85, 0.8 or even less. But then also try to limit the search range [minRadius, maxRadius] to avoid many false circles. Preset to the OpenCV default (100.0).
minRadiusoptINT0-2147483648–2147483647Minimum circle radius. Preset to the OpenCV default (0).
maxRadiusoptINT0-2147483648–2147483647Maximum circle radius. If <= 0, uses the maximum image dimension. If < 0, #HOUGH_GRADIENT returns centers without finding the radius. #HOUGH_GRADIENT_ALT always computes circle radiuses. Preset to the OpenCV default (0).

Outputs (1)

NameTypeDescription
nparrayNPARRAY