Nodes/comfyui_cv/CV Track Features (KLT)
ComfyUI Node

CV Track Features (KLT)

Tracks corner features from frame_a into frame_b with pyramidal Lucas-Kanade optical flow (cv2.goodFeaturesToTrack + cv2.calcOpticalFlowPyrLK) - the sparse tracker behind monocular visual odometry. Both frames are grayscaled, corners are detected in frame_a and tracked into frame_b, and only confidently-tracked pairs are kept: the optical-flow status flag must be set AND (forward-backward check) re-tracking the point back into frame_a must land within fb_threshold pixels of where it started. Outputs the matched points in both frames (Nx1x2, same order), ready for 'OpenCV Recover Pose'. Finding zero trackable corners is a valid result (count = 0, empty arrays), not an error - so a VO pipeline never halts on a textureless or blank frame.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Track Features (KLT)
  • frame_a
  • frame_b
  • mask
  • points_a
  • points_b
  • count
max_features500
quality0.010
min_distance7.00
win_size21
max_level3
fb_threshold1.0
Categoryimage/CV/features

Inputs (9)

NameTypeDefaultDescription
frame_aNPARRAY,IMAGEEarlier frame; corners are detected here. Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size.
frame_bNPARRAY,IMAGELater frame; resized to frame_a if sizes differ. Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size.
max_featuresINT5000–10000Maximum corners to detect in frame_a (goodFeaturesToTrack); 0 = return all detected corners.
qualityFLOAT0.0100.0001–1Minimum corner quality relative to the strongest corner (qualityLevel); lower keeps weaker corners.
min_distanceFLOAT7.001–100Minimum spacing in pixels between detected corners.
win_sizeINT213–101Lucas-Kanade search window (forced odd); larger tolerates bigger motion but blurs fine detail.
max_levelINT30–8Pyramid levels (0 = no pyramid); more levels track larger displacements.
fb_thresholdoptFLOAT1.00–30Forward-backward consistency gate in pixels: a track is dropped if re-tracking it back misses its origin by more than this. 0 disables the check.
maskoptNPARRAY,MASKOptional mask: detect corners only where mask > 0. Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size.

Outputs (3)

NameTypeDescription
points_aNPARRAYTracked corners in frame_a, Nx1x2 float32.
points_bNPARRAYTheir tracked positions in frame_b, Nx1x2 float32 (same order).
countINT