Nodes/opencv-comfyui/OpenCV circle_0
ComfyUI Node

OpenCV circle_0

Draw a circle on your image — OpenCV's drawing node in ComfyUI

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV circle_0
  • img
  • nparray
center
radius
color
thickness
lineType
shift

circle is OpenCV's drawing primitive: you give it an image, a center point, a radius, and a color, and you get the same image back with a circle drawn on it. It's the node you reach for when you want to annotate a frame - marking a face bbox center, circling a detected region, putting a target reticle on a preview - or when you want to overlay geometry on an image for a mask or sketch pass. Simple, deterministic, no model involved.

Inputs. Seven of them, and here's where the pack's rough edges show:

  • img (NPARRAY) - the image to draw on, BGR 0..255 uint8 on the OpenCV side
  • center (STRING) - a Python literal, (x, y), e.g. (512, 512)
  • radius (INT) - in pixels
  • color (STRING) - a BGR tuple literal, e.g. (0, 0, 255). BGR, not RGB - that's red, because the image is BGR inside this pack. (255, 0, 0) is blue. This ordering tripwire gets everyone at least once.
  • thickness (INT) - line width in pixels; negative values like -1 fill the circle
  • lineType (INT) - anti-aliasing choice; 8 (LINE_8) or 16 (LINE_AA) are the usual picks
  • shift (INT) - sub-pixel precision for center/radius; leave at 0

Output is a single nparray - the image with the circle drawn. Because OpenCV draws in-place and returns the same array, you can chain drawing nodes: put a circle, then a line, then another circle, feeding each output into the next input, to build up an annotated frame.

The gotchas. First, the composite-string parsing: center and color go through literal_eval, so parentheses and commas matter - (100, 100) works, 100, 100 without parens may not, and a stray character throws the README's invalid syntax (unknown, line 0). Second, remember the color order: this pack lives in BGR. If you picked a red (0,0,255) and got blue, that's the conversion - Image2Nparray flips RGB to BGR on the way in. Third, batch_size == 1 only: Image2Nparray will refuse multi-image batches, so pull a single frame with ImageFromBatch first.

Install. Standard pack story - ComfyUI Manager, search "OpenCV", or:

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-python-contrib

Restart after; no model files. And yes, circle_1 is the identical twin - the pack numbers overloads and duplicates them. Use either. The author's warning stands: auto-generated, ugly, "expect dragons." Drawing a circle is a friendly dragon, though.

Categoryimage/OpenCV

Inputs (7)

NameTypeDefaultDescription
imgNPARRAY
centerSTRING
radiusINT
colorSTRING
thicknessINT
lineTypeINT
shiftINT

Outputs (1)

NameTypeDescription
nparrayNPARRAY