ComfyUI Node
CV Draw Flow Grid
Debug helper: renders a DENSE flow field (HxWx2, e.g. the 'flow' output of 'CV Optical Flow (Farneback)') as the classic quiver plot - one arrow per regularly-spaced grid cell. Each arrow is colored by its motion MAGNITUDE relative to the field's maximum (auto, or a fixed max_magnitude to compare frames on one scale), through a named colormap. Complements 'CV Flow To Color' (per-pixel direction wheel) and 'CV Draw Flow Vectors' (SPARSE point pairs). An empty/zero field draws nothing and returns count=0.
CV Draw Flow Grid
- flow
- source
- nparray
- count
◄step16►
◄scale1.0►
◄thickness1►
◄colormapCOLORMAP_VIRIDIS►
◄tip_length0.30►
◄min_magnitude0.00►
◄max_magnitude0.00►
Categoryimage/CV/features
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| flow | NPARRAY | HxWx2 float (dx, dy) per pixel - the dense flow field from 'CV Optical Flow (Farneback)'. | |
| step | INT | 162–256 | Grid spacing in pixels: one arrow is sampled every 'step' pixels. Smaller = denser, busier. |
| scale | FLOAT | 1.00.1–50 | Arrow-length multiplier for visibility only (the COLOR still encodes the true, unscaled magnitude). Raise it when sub-pixel flow makes the arrows too short to see. |
| thickness | INT | 11–32 | Arrow line width in pixels. |
| colormap | COMBO | COLORMAP_VIRIDIS | Maps magnitude to color. The slowest grid arrow takes the cold end, the fastest the hot end. The default is perceptually uniform and rises monotonically in brightness, so slow-vs-fast reads correctly for a colour-blind viewer and in greyscale; COLORMAP_JET is the familiar blue->red but does neither. |
| sourceopt | NPARRAY,IMAGE,MASK | Optional canvas (IMAGE or MASK) to draw the arrows over (resized to the flow if the sizes differ); a black canvas is used if omitted. 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. | |
| 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 the static background. 0 draws every grid cell. |
| max_magnitudeopt | FLOAT | 0.000–1000000 | Magnitude mapped to the hot end of the colormap; larger values clip. 0 = auto (this field's fastest grid arrow) - set it to compare frames on one scale. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | BGR uint8 quiver rendering. |
| count | INT | How many arrows were drawn (after the min_magnitude filter) - branch on it with if/else for nothing-moved. |