OpenCV arcLength_1
ArcLength_1 — the duplicate perimeter node you can ignore
- curve
- float
arcLength_1 is the same node as arcLength_0. OpenCV's type stubs list cv2.arcLength twice (a MatLike overload and a UMat overload), and this pack - which auto-generates a wrapper per overload - dutifully shipped both. The two are byte-for-byte identical in behavior: same inputs, same FLOAT output, same call to the underlying function.
So if you've already met arcLength_0, you can stop reading here. The rest of this page is for people who landed on this one first.
What it does
Measures the perimeter of a contour. Inputs:
- curve - the contour as an
NPARRAYof points (N×1×2 or N×2, same shapefindContoursproduces). - closed -
Trueto close the loop (counts the last-point-to-first segment),Falsefor an open polyline. - Output: one float, the arc length in pixels.
No optional parameters, no literal-string widgets, no color conversions. It's the cleanest node in the pack, and honestly one of the most useful, because of the recipe it feeds: approxPolyDP's epsilon is conventionally set to a small fraction of the arc length (0.01 * arcLength), which makes polygon simplification scale with the size of the shape instead of relying on a magic constant. Measure here, multiply by 0.01, feed the result into approxPolyDP_0's epsilon input, and your contour simplification just got a lot more robust.
The data-type trap
The output is a number, not an image. If you've routed arcLength_1 into something expecting an NPARRAY and you're seeing 'NoneType' object has no attribute 'shape', that's the pack's way of telling you the types don't line up - floats don't go where images go. Wire the value into a float consumer or a math node and you're fine.
Install
Part of opencv-comfyui, same as every sibling page here:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-python-contrib
or install through ComfyUI Manager by searching "opencv-comfyui", then restart. No models to fetch. The pack's one known install gotcha is a conflicting OpenCV build (Cannot import name 'guidedFilter' from 'cv2.ximgproc') - reinstall cleanly if you see it.
Bottom line: pick _0 or _1, whichever your graph already has, and treat the other as a spare. The generator's duplicate overloads are a quirk of this pack, not a feature - don't go hunting for a difference, because there isn't one.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| curve | NPARRAY | — | |
| closed | BOOLEAN | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| float | FLOAT | — |