OpenCV ellipse_0
Draw an ellipse (or just an arc) with literal coordinates
- img
- nparray
ellipse_0 is the full-parameter version of OpenCV's ellipse drawing function - the one where you control everything: center, axes, rotation, how much of the arc to draw, color, thickness. It's an annotation/overlay primitive, useful whenever you want to ring something on an image with a mathematically exact ellipse: a face region, a wheel, an object's outline, or a UI-style ring. It's also the node that will teach you to love (or hate) this pack's "everything is a Python literal" design, because the points and colors arrive as strings.
The inputs that matter
img- yourNPARRAY.center- aSTRINGliteral,(cx, cy).axes- aSTRINGliteral,(a, b), where these are the half-lengths of the ellipse's two axes (the semi-axes), not the full width/height. Classic gotcha: a(100, 50)axes means a 200×100 ellipse.angle- rotation of the whole ellipse in degrees.startAngle,endAngle- degrees around the ellipse.0and360draw a full ellipse; anything else draws an arc between those angles. This is how you make pie-chart slices or partial rings.color- aSTRINGliteral in BGR (this pack's pipeline is BGR: red is(0, 0, 255)).thickness- stroke width; a negative value fills the ellipse instead of outlining it.lineType- 8 for default, 16 for anti-aliased.shift- subpixel precision shift; leave it at 0.
Single nparray output.
Install
In 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 downloads. _0/_1 are identical overloads.
The traps, spelled out
The literal parsing is the big one. These strings are evaluated with ast.literal_eval, so (250, 250) works and 250, 250 throws the pack's trademark invalid syntax (<unknown>, line 0). Nested literals like (250, 250) are fine - it's the missing parens that kill you. And the BGR color thing will get you at least once: (0, 0, 255) is red here, not blue.
House rules otherwise: images come in through Image2Nparray (RGB→BGR) and out through Nparrays2Image, and only batch_size==1 is supported.
Honest take: if you're drawing lots of ellipses, this is fiddlier than a dedicated drawing pack with proper widgets - the string literals are the pack's compromise for composite types. But inside a cv2 pipeline it's the exact primitive you want, and arcs from startAngle/endAngle are something most UI-oriented annotation packs don't give you.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| img | NPARRAY | — | |
| center | STRING | — | |
| axes | STRING | — | |
| angle | FLOAT | — | |
| startAngle | FLOAT | — | |
| endAngle | FLOAT | — | |
| color | STRING | — | |
| thickness | INT | — | |
| lineType | INT | — | |
| shift | INT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |