Skip to main content

Optical Flow video tools

Project description

Logo

Toolkit to generate customized visualizations related to optical flow (beta 0.2.1)
PyPI page · Installation · Examples · Presets

color_flow result color_epe result track_points result

Table of contents

Installation

flowvid is available as a PyPI package:

pip3 install flowvid

Or you can install it directly from Github:

pip3 install git+https://github.com/diegoroyo/flowvid/

or you can clone the repo:

git clone https://github.com/diegoroyo/flowvid.git
cd flowvid
scripts/local_install.sh

Quick start

Flowvid is a python library for video generation, but it also contains several video presets with an user-friendly assistant:

  • Presets can be listed using python3 -m flowvid -h
$ python3 -m flowvid -h

usage: flowvid [-h] preset

Generate an optical flow visualization using the available presets.

Preset can be one of:
  color_flow: Convert flow data to RGB using the Middlebury representation
  color_epe: Calculate endpoint error and generate a video representation
  plot_epe: Generate a pyplot plot with the EPE distribution in all frames
  track_points: Place points in a image and see how flow moves them
  track_side_by_side: Place points in a image and see how flow can track them

positional arguments:
  preset      Video preset, see above.

optional arguments:
  -h, --help  show this help message and exit
  • Example: converting flow files to rgb and saving into a video
$ python3 -m flowvid color_flow

Flow files directory (default: flo): path/to/flo/dir 
Vector normalize type (video, [frame], none): video
Normalization clamp percentage (default: 1.0): 0.8
Normalization gamma curve exponent (default: 1.0): 1.5
Video framerate (default: 24): 12
Output video name (default: output_color_flow.mp4): flowcolors.mp4 

color_flow result

Here are some examples illustrating the other presets' results:

color_epe plot_epe
color_epe result plot_epe result
track_points track_side_by_side
track_points result track_side_by_side result

Python library

If you want to generate more complex or customized videos, you can easily use flowvid's tools:

import flowvid as fv

# Read flow files data
flo_data = fv.input.flo('path/to/flo/dir')

# Normalize each file (so max flow's module is 1),
# necessary to convert to RGB
flo_data = fv.normalize_frame(flo_data)
rgb_data = fv.flow_to_rgb(flo_data)

# Output as video
out = fv.output.video(filename='output.mp4', framerate=24)
out.add_all(rgb_data)

Acknowledgements

C. Liu. Beyond Pixels: Exploring New Representations and Applications for Motion Analysis. Doctoral Thesis. Massachusetts Institute of Technology. May 2009.

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

flowvid-0.2.1.tar.gz (22.5 kB view hashes)

Uploaded Source

Built Distribution

flowvid-0.2.1-py3-none-any.whl (51.6 kB view hashes)

Uploaded Python 3

Supported by

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