OpenCV fitEllipse_1
FitEllipse_0's twin — same ellipse, either name
- points
- literal
OpenCV fitEllipse_1 is fitEllipse_0 under a different number. Same single input (points, an NPARRAY of at least 5 2D points), same cv2.fitEllipse call, same single output: a literal (STRING) carrying the fitted ellipse as a RotatedRect - ((center_x, center_y), (width, height), angle). The duplicate is the pack's standard MatLike/UMat artifact from OpenCV's type stubs; there's no behavioral difference to weigh.
The useful content is all in the _0 article. Recap: least-squares fit of an ellipse to a point set, ideal for "describe my blob" workflows. Get your points from findNonZero off a thresholded mask (the pack's natural point-list producer), keep them as floats, and the node returns the ellipse's center, axes, and angle as a serialized value. Feed those values back into this pack's ellipse node (as a literal) to draw the fit.
What to actually watch for
- The output isn't an image. It's a composite value serialized as text. Trying to preview it throws the pack's
'NoneType' object has no attribute 'shape'error. Read it, or feed its parts into drawing nodes. - Five points minimum, floats required. Fewer and OpenCV asserts; integers and OpenCV grumbles.
np.float32is the safe cast. - Garbage in, confident ellipse out. The fit always produces an ellipse; it won't tell you that your point set wasn't ellipse-like. That's a you problem, not a node problem.
Install
Same pack. ComfyUI Manager → search opencv-comfyui → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
requirements.txt installs opencv-contrib-python, numpy, torch. Startup failure almost always means cv2 didn't import - duplicate OpenCV installs are the usual suspect, and Cannot import name 'guidedFilter' is the symptom.
Use _0 or _1, doesn't matter. When you need a more outlier-robust fit, fitEllipseAMS is the sibling function worth knowing about.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| points | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| literal | STRING | — |