OpenCV convexityDefects_1
ConvexityDefects_1 — the twin, and the finger-valley caveat
- contour
- convexhull
- convexityDefects
- nparray
convexityDefects_1 is the second overload of cv2.convexityDefects - the UMat variant next to the MatLike one in OpenCV's type definitions - and this auto-generated pack shipped both. The nodes are identical. The real article is convexityDefects_0; this is the signpost page for the _1 suffix, plus the one caveat worth repeating.
What the node does: given a contour (NPARRAY) and a convexhull (NPARRAY), it finds the indentation points where the contour diverges from its convex hull - the valleys between fingers in hand tracking, the notches in an irregular detected region. Output is an NPARRAY of (N, 1, 4) rows: [start_index, end_index, farthest_index, depth], where depth is how far the contour sags from the hull and the one column you'll actually threshold on.
The caveat, because it's the classic failure: the convexhull input must be the index form, produced by convexHull_0 with returnPoints set to False. Feed it a points-form hull and OpenCV rejects it with an assertion error and zero explanation in the UI. That single detail is the difference between a working finger-counting chain and an afternoon of head-scratching.
Install, same as the pack
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-python-contrib
Or ComfyUI Manager → opencv-comfyui → restart.
And the standard nparray reminders: these nodes run on numpy arrays, not Comfy IMAGE tensors - Image2Nparray (batch 1 only) on the way in - and the outputs are geometry, not pictures, so they won't display through Nparrays2Image.
Between _0 and _1: no functional difference whatsoever. If your workflow references convexityDefects_1, keep it; if you're building fresh, pick either. The suffix is pure auto-generation noise from overloaded signatures.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| contour | NPARRAY | — | |
| convexhull | NPARRAY | — | |
| convexityDefectsopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |