Nodes/comfyui_cv/CV Enclosing Circle
ComfyUI Node

CV Enclosing Circle

Smallest circle around a contour (cv2.minEnclosingCircle) - e.g. a clock dial, a ball, a coin. 'longest contour' (the default) selects by perimeter, which stays robust when the shape's outline breaks into an open arc: an open curve traces out and back, so its AREA is near zero and area-based selection would pick some small closed blob instead (this happened with a clock rim that lost a few edge pixels to decoder differences). 'largest contour' selects by area; 'all contours merged' circles every contour point at once. Failure-tolerant: with no contours it returns found=false and zeros instead of stopping the workflow (downstream nodes treat radius 0 as not-found).

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Enclosing Circle
  • contours
  • center_x
  • center_y
  • radius
  • found
  • center
selectlongest contour (perimeter)
Categoryimage/CV/contours

Inputs (2)

NameTypeDefaultDescription
contoursCV_CONTOURSFrom 'CV Find Contours'.
selectCOMBOlongest contour (perimeter)Which contour to circle. Perimeter is robust to broken outlines; merged spans everything (use it when the whole edge map belongs to one object).

Outputs (5)

NameTypeDescription
center_xFLOAT
center_yFLOAT
radiusFLOAT
foundBOOLEAN
centerCV_TUPLEThe centre as ONE composite (x, y) value - wire it into a cv2 node's centre/point input in one link instead of two. Subpixel: a point2i input rounds it.