OpenCV calcOpticalFlowPyrLK_1
The twin of sparse flow tracking
- prevImg
- nextImg
- prevPts
- nextPts
- status
- err
- nparray_0
- nparray_1
- nparray_2
OpenCV calcOpticalFlowPyrLK_1 is calcOpticalFlowPyrLK_0 under a second overload number. Same function, same inputs, same outputs, same quirks - the opencv-comfyui generator emitted a node per overload it found in OpenCV's type stubs, and cv2.calcOpticalFlowPyrLK has two. There is nothing to choose between them.
So what does it do? Sparse optical flow: you hand it two frames and a set of starting points, and it returns where each point moved, a per-point success flag, and an error estimate. It's the pyramidal Lucas–Kanade tracker - the workhorse behind object tracking, video stabilization, and feature matching for decades. Compared to the dense Farneback node, this one's output is friendlier: points and status flags, not a two-channel field you must visualize.
Inputs
- prevImg / nextImg -
NPARRAYframes, grayscaleuint8. RGB in →img.type() == CV_8UC1assertion, the README's own troubleshooting entry; convert withcvtColor(code 6). - prevPts -
NPARRAY, your(N, 2)float32 starting points. - nextPts -
NPARRAY: an out-parameter surfaced as a required input (the generator's roughness). Wire a same-size array; it gets overwritten and the tracked points come back on the first output. - winSize - STRING literal,
(21, 21)(aSize). - maxLevel - INT, pyramid depth;
3typical. - criteria - STRING literal,
(3, 30, 0.01)(TermCriteria: EPS+COUNT, 30 iters, 0.01). - flags - INT,
0(1 =OPTFLOW_LK_GET_MIN_EIGENVALS, 2 =OPTFLOW_USE_INITIAL_FLOW). - minEigThreshold - FLOAT,
1e-4typical. - status / err (optional) - out-parameters; leave unwired.
Outputs: nparray_0 (tracked points), nparray_1 (status 1.0/0.0), nparray_2 (error). None are images.
Install and the verdict
ComfyUI Manager → opencv-comfyui, or clone https://github.com/geroldmeisinger/opencv-comfyui into ComfyUI/custom_nodes, restart; needs opencv-contrib-python. Batch size 1, NPARRAY conventions, same as everywhere in this pack.
It's a genuine CV primitive for people who already have points to track - for them it's the real deal, and the _1/_0 distinction is pure pack artifact. For everyone else, the grayscale requirement plus the required-out-parameter nextPts make it more ceremony than most ComfyUI workflows justify. Know it exists, know it's a real Lucas–Kanade tracker, and reach for it when your graph actually does feature tracking.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| prevImg | NPARRAY | — | |
| nextImg | NPARRAY | — | |
| prevPts | NPARRAY | — | |
| nextPts | NPARRAY | — | |
| winSize | STRING | — | |
| maxLevel | INT | — | |
| criteria | STRING | — | |
| flags | INT | — | |
| minEigThreshold | FLOAT | — | |
| statusopt | NPARRAY | — | |
| erropt | NPARRAY | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| nparray_0 | NPARRAY | — |
| nparray_1 | NPARRAY | — |
| nparray_2 | NPARRAY | — |