Nodes/comfyui_cv/CV Optical Flow (DeepFlow / PCAFlow)
ComfyUI Node

CV Optical Flow (DeepFlow / PCAFlow)

Two more dense optical-flow algorithms from cv2.optflow, both class-gated and neither tunable (their Python bindings expose no setters). DeepFlow matches a descriptor pyramid before the variational solve, which is what lets it follow LARGE displacements that pyramidal methods lose. PCAFlow projects the field onto a learned low-dimensional basis: it is fast and immune to noise, but it can only produce motion its basis can express, so fine structure is smoothed away. Start with 'OpenCV Optical Flow (DIS)' and come here when the motion is too big (DeepFlow) or the input too noisy (PCAFlow).

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Optical Flow (DeepFlow / PCAFlow)
  • frame_a
  • frame_b
  • flow
  • magnitude
  • angle
algorithmDeepFlow (large motion)
Categoryimage/CV/contrib

Inputs (3)

NameTypeDefaultDescription
frame_aNPARRAY,IMAGEFirst frame (earlier in time); converted to grayscale. 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,IMAGESecond frame; resized to frame_a if the 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.
algorithmCOMBODeepFlow (large motion)DeepFlow: descriptor matching + variational refinement, best on large motion, slowest here. PCAFlow: learned-basis projection, fast and noise-tolerant, blurs fine structure.

Outputs (3)

NameTypeDescription
flowNPARRAYHxWx2 float32 (dx, dy) displacement per pixel.
magnitudeNPARRAYHxW float32 motion magnitude in pixels.
angleNPARRAYHxW float32 motion direction in RADIANS - feed 'CV Flow To Color' in its default radians mode.