Skip to main content

CLI and Python API for optical flow video processing

Project description

motionflow

CLI and Python API for optical flow video processing.

motionflow input.mp4

Install

pip install motionflow          # classical methods only
pip install motionflow[torch]   # + RAFT and deep methods
conda install -c conda-forge motionflow    # includes PyTorch
pixi global install motionflow             # auto-selects GPU/CPU torch

Usage

CLI

# HSV colour-wheel flow (default: Farneback)
motionflow recording.mp4

# RAFT on GPU, heatmap style, every other frame
motionflow recording.mp4 --method raft --device cuda --viz heatmap --stride 2

# Blend flow 40% over original, with temporal smoothing
motionflow recording.mp4 --viz blend --blend 0.4 --smooth 3

# Quiver arrow overlay
motionflow recording.mp4 --viz quiver --quiver-step 24

Python API

from motionflow import process_video

out = process_video(
    "recording.mp4",
    method="raft",
    viz="hsv",
    stride=2,
    device="auto",
)

Using estimators directly

import cv2
from motionflow.methods import FarnebackFlow
from motionflow.viz import flow_to_hsv

flow = FarnebackFlow()(prev_frame, curr_frame)  # (H, W, 2)
vis  = flow_to_hsv(flow)                         # BGR image

Methods

Method Type GPU Notes
farneback Dense No Default, fast
tvl1 Dense No Sharp edges, slow; requires opencv-contrib
lucas-kanade Sparse No Good with --viz quiver
raft Dense Yes High quality; weights auto-downloaded
sea-raft Dense Yes ECCV 2024; coming soon
neuflow Dense Yes Edge-optimised; coming soon

Documentation

roaldarbol.github.io/motionflow

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

motionflow-0.1.0.tar.gz (102.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

motionflow-0.1.0-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file motionflow-0.1.0.tar.gz.

File metadata

  • Download URL: motionflow-0.1.0.tar.gz
  • Upload date:
  • Size: 102.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for motionflow-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c54356651c4c332add684355d96c89bb33c269fc91b0af20c3ee016587e295c6
MD5 302c0717f81c92b8b2c42fcac935795d
BLAKE2b-256 eb148bf3532a6b398c077b42b7b7373056d3442c967590d6fb9c59b952eeff4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for motionflow-0.1.0.tar.gz:

Publisher: publish.yml on roaldarbol/motionflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file motionflow-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: motionflow-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for motionflow-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ef5476a36f597a06e6f48cb889bb2a7ef1bde6948be93b704bd9a2badd5f98d
MD5 d22827e4faf8e5ea7147339e44bc04d9
BLAKE2b-256 6180ddb2c7519e47bfd9d2b135c1ab581b3c0648f910b8b054fbfa7e2d5e44fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for motionflow-0.1.0-py3-none-any.whl:

Publisher: publish.yml on roaldarbol/motionflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page