Nodes/opencv-comfyui/OpenCV fitEllipseDirect_1
ComfyUI Node

OpenCV fitEllipseDirect_1

FitEllipseDirect_1 is the same node as fitEllipseDirect_0. Really.

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV fitEllipseDirect_1
  • points
  • literal

Straight answer first: fitEllipseDirect_1 is a duplicate of fitEllipseDirect_0. Same inputs, same output, byte-for-byte the same underlying code in the current release. If you searched the node menu and found two identical ellipse fitters sitting next to each other, you're not hallucinating - that's the pack's doing, and it's worth understanding why before you pick.

This pack is auto-generated from OpenCV's Python type stubs. OpenCV declares several functions with multiple overload signatures, and the generator turned each overload into its own numbered node - _0, _1, sometimes _2, _3. For some functions the overloads genuinely differ in the parameters they accept. For fitEllipseDirect, the two signatures came out looking identical after the generator filtered out unsupported types, so you get two nodes that do exactly the same thing.

Which means: it doesn't matter which one you drop into your workflow. They produce the same result.

What the node does

Since you're here anyway: it fits an ellipse to a set of 2D points using OpenCV's fitEllipseDirect, the fast direct least-squares method. Feed it a point cloud or contour, get the fitted ellipse geometry back.

  • points (NPARRAY) - the 2D points to fit, usually N×2 (x, y) coordinates.
  • literal (STRING) - the fitted ellipse as a string: ((center_x, center_y), (width, height), angle).

The string output is the pack's autogenerated compromise for composite types like RotatedRect - parse it if you need numbers, and don't mistake it for a bug. It's how the whole pack behaves.

Installing

It's part of geroldmeisinger/opencv-comfyui, so installing once gets you both variants. ComfyUI Manager: search "opencv-comfyui". Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui

Restart after cloning. The pack needs opencv-contrib-python (in its requirements.txt alongside numpy and torch); a bare environment may need pip install opencv-contrib-python.

Common issues

The usual pack gotchas apply: convert Comfy IMAGE to NPARRAY via Image2Nparray (it only accepts batch_size==1), and make sure points is a coordinate array, not pixels. If the ellipse fit comes out wrong on noisy data, prefer the AMS variant - fitEllipseAMS is robust to outliers; Direct isn't.

One thing worth knowing: the duplicate node situation is the pack working as designed, but it's also a sign of how rough the edges are. The author's own README says these nodes are "auto-generated from source and so they are ugly and complex to use. Expect dragons!" - and then asks for feedback. If a node family's overloads all collapse into identical duplicates, that's the price of a pack that wraps 635 functions with zero hand-tuning. Use either one; the dragons are documented.

Categoryimage/OpenCV

Inputs (1)

NameTypeDefaultDescription
pointsNPARRAY

Outputs (1)

NameTypeDescription
literalSTRING