ComfyUI Node
CV Draw Flow Vectors
Debug helper: draws an arrow from each 'from' point to its matching 'to' point - the proper way to look at SPARSE optical flow / feature tracks (the equal-length, same-order point pairs that 'CV Track Features (KLT)' and 'CV Match Features' produce). Color the arrows by motion direction (the standard flow color wheel) or magnitude (a heatmap), or by cluster when labels are connected (for motion segmentation). None/empty inputs pass the image through unchanged and count=0; tiny motions below min_magnitude are skipped.
CV Draw Flow Vectors
- source
- points_from
- points_to
- labels
- image
- count
◄thickness1►
◄color(0, 255, 0)►
◄color_bydirection (color wheel)►
◄tip_length0.30►
◄min_magnitude0.00►
◄max_magnitude0.00►
◄magnitude_colormapCOLORMAP_VIRIDIS►
Categoryimage/CV/points
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| source | COMFY_MATCHTYPE_V3 | Image or mask to draw on (a copy is made). 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. | |
| points_from | NPARRAY | Nx1x2 arrow tails - the points in the FIRST frame (e.g. 'Track Features (KLT)' points_a). | |
| points_to | NPARRAY | Nx1x2 arrow heads - the SAME points in the second frame (points_b); must match points_from in count and order. | |
| thickness | INT | 11–64 | Arrow line width in pixels. |
| color | STRING | (0, 255, 0) | Color as a single value (broadcast to all channels) or BGR tuple, e.g. '255' or '(0, 255, 0)'. Shorter tuples are zero-padded; longer tuples are truncated. Used only in 'fixed color' mode (and ignored when labels are connected). |
| color_by | COMBO | direction (color wheel) | How to color each arrow: a single fixed color; by motion DIRECTION (hue = angle, the standard flow wheel - hue alone, so it is a picture to look at, not a key to read); or by MAGNITUDE, through 'magnitude_colormap' (dark = slow -> bright = fast, readable as brightness alone). Connecting labels overrides this with per-cluster colors. |
| tip_lengthopt | FLOAT | 0.300–2 | Arrowhead length as a fraction of the shaft (cv2.arrowedLine tipLength). |
| min_magnitudeopt | FLOAT | 0.000–1000000 | Skip arrows shorter than this many pixels - hides sub-pixel tracking jitter. 0 draws everything. |
| max_magnitudeopt | FLOAT | 0.000–1000000 | Magnitude mapped to the hot end of the heatmap; larger clip. 0 = auto (this frame's longest vector) - set it to compare frames on one scale. |
| labelsopt | NPARRAY | (N,) integer labels: one color per cluster (e.g. motion segmentation), overriding color_by. | |
| magnitude_colormapopt | COMBO | COLORMAP_VIRIDIS | Ramp for the 'magnitude (heatmap)' mode. The default is perceptually uniform and rises monotonically in brightness, so slow-vs-fast survives colour blindness and greyscale; COLORMAP_JET is the familiar blue->red but does neither. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | COMFY_MATCHTYPE_V3 | Same format as the image input. |
| count | INT | How many arrows were drawn (after the min_magnitude filter) - branch on it with if/else for the nothing-moved case. |