Nodes/opencv-comfyui/OpenCV ellipse_1
ComfyUI Node

OpenCV ellipse_1

Ellipse, overload two — same arcs, same literal gotchas

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV ellipse_1
  • img
  • nparray
center
axes
angle
startAngle
endAngle
color
thickness
lineType
shift

ellipse_1 is ellipse_0 with a different number on the end. OpenCV declares cv2.ellipse twice in its type stubs - MatLike and UMat - and this pack generated one node per declaration, so the two are behaviorally identical. Pick either; the work is the same.

The work, in case you're new to it: drawing an ellipse or elliptical arc onto an image with full control over geometry and style. Inputs:

  • img - your NPARRAY.
  • center - literal (cx, cy).
  • axes - literal (semi_a, semi_b) - note these are half-lengths, so a (100, 50) axes draws a 200×100 ellipse. This trips people constantly.
  • angle - rotation in degrees.
  • startAngle, endAngle - arc extent in degrees; 0/360 is a full ellipse, anything else is a partial arc (that's your pie-slice / ring maker).
  • color - literal in BGR. Red is (0, 0, 255) in this pipeline.
  • thickness - negative fills instead of outlines.
  • lineType - 8 or 16 (anti-aliased).
  • shift - subpixel shift, leave 0.

One nparray output.

Install

opencv-comfyui (geroldmeisinger). ComfyUI Manager → search OpenCV, or:

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

Restart. requirements.txt: opencv-contrib-python, numpy, torch; no model files.

What will bite you

The pack parses every composite argument with ast.literal_eval, so your strings must be valid Python literals - (250, 250) yes, 250, 250 no, and a missing paren gives you the famous invalid syntax (<unknown>, line 0) that looks like a ComfyUI bug but is your typo. The BGR color order is the other recurring surprise. And the usual pack rules: in through Image2Nparray, out through Nparrays2Image, batch_size==1 only.

There's a sibling worth knowing about: ellipse_2/ellipse_3 in the same pack draw an ellipse from a RotatedRect - the ((center), (size), angle) form you get from fitEllipse or minAreaRect. If you're visualizing detected rotated boxes, that's the pair you actually want; this full-parameter version is for when you're specifying the geometry by hand. Different tools, same family.

Categoryimage/OpenCV

Inputs (10)

NameTypeDefaultDescription
imgNPARRAY
centerSTRING
axesSTRING
angleFLOAT
startAngleFLOAT
endAngleFLOAT
colorSTRING
thicknessINT
lineTypeINT
shiftINT

Outputs (1)

NameTypeDescription
nparrayNPARRAY