Converts Optical Flow .flo files to images .png and optionally compiles them to a video .mp4 via ffmpeg
Installation
PyPI
Easiest option to install flowiz is to grab the latest package from PyPI repo
pip install flowiz -U
pip + Github
Alternatively you may install the package directly from github repo
pip install git+https://github.com/georgegach/flowiz/
Build yourself
Or you can run setup.py to build it yourself locally
git clone https://github.com/georgegach/flowiz.git
cd flowiz
python setup.py install --user
Make sure you have requirements installed along with an ffmpeg to compile a video. requirements.txt contains latest working versions of this package. Feel free to use pip-upgrader.
pip install -r requirements.txt
apt install ffmpeg
# pacman -S ffmpeg
Usage
Package can be used both from the command line and python script.
Command line usage
The following script grabs .flo files from ./demo/flo/ directory and converts into .png saving in the same directory
python -m flowiz demo/flo/*.flo
You can pass output directory for .png images via -o or --outdir parameter
python -m flowiz demo/flo/*.flo --outdir demo/png/
You may compile converted .png images into a 24 fps .mp4 clip by passing -v or --videodir parameter with a video output directory (without a filename)
python -m flowiz demo/flo/*.flo -o demo/png --videodir demo/mp4
Pass -r or --framerate parameter to control the framerate of compiled video
python -m flowiz demo/flo/*.flo -o demo/png -v demo/mp4 --framerate 2
Python usage
Relevant python code is available in demo/test.ipynb notebook. Here's an excerpt:
import flowiz as fz
files = glob.glob('demo/flo/*.flo')
img = fz.convert_from_file(files[0])
plt.imshow(img)
In case you need to visualize U V channels separately from your numpy floArray:
uv = fz.convert_from_flow(floArray, mode='UV')
axarr[0].imshow(uv[...,0], cmap=plt.get_cmap('binary'))
axarr[1].imshow(uv[...,1], cmap=plt.get_cmap('binary'))
GUI usage
Beta version of the flowiz graphical user interface is now accessible via flowiz.gui package. It is packaged using ChrisKnott / Eel and available via default web browser. To run the GUI simply type:
python -m flowiz.gui
Upon launching the web app, drag and drop or choose .flo file(s) using the open file dialog. Files will be converted using the python backend and placed in a temporary directory flowiz/gui/web/guitemp. Upon every session temporary directory will be emptied to avoid unnecessary polution.
Mockup of the GUI is available at georgegach.github.io/flowiz
Help
$ python -m flowiz -h
usage: __main__.py [-h] [--outdir OUTDIR] [--videodir VIDEODIR]
[--framerate FRAMERATE]
input [input ...]
positional arguments:
input Input file(s). (e.g.: __ ./demo/flo/*.flo)
optional arguments:
-h, --help show this help message and exit
--outdir OUTDIR, -o OUTDIR
Output directory path. Default: same directory as
[.flo] files. (e.g.: __ -o ./demo/png/)
--videodir VIDEODIR, -v VIDEODIR
Compiles [.mp4] video from [.png] images if parameter
is passed. Parameter requires video output directory
path without a filename. (e.g.: __ -v ./demo/mp4/)
--framerate FRAMERATE, -r FRAMERATE
Frames per second of the video. (e.g.: __ -r 2)
Acknowledgements
The library is based on Midlebury's Vision Project MATLAB code: http://vision.middlebury.edu/flow/ Original credits to Daniel Scharstein (C++) and Deqing Sun (MATLAB)
FAQ
Q: But what kind of name is
flowiz?
A: The kind you choose whenflowkit,flowtools,flowlib,flowlabare already taken.
Q: Future work?
A: Some of theTo-Dofeatures are listed below with no determined timeline. If you'd like to contribute with the said features or something completely new, you mayand issue a pull request.
To-Do
- Ported from Matlab
flow_code - Project is available on PyPI
- GUI
- Improve Front to Back-end throughput performance
Metadata
Release files for flowiz 2.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flowiz-2.4.0.tar.gz | 2.1 MB | Without provenance | Details for flowiz-2.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flowiz-2.4.0-py3-none-any.whl | Python 3 | none | any | Details for flowiz-2.4.0-py3-none-any.whl |
Total release size: 4.2 MB
Release files / flowiz-2.4.0.tar.gz
| Download URL | flowiz-2.4.0.tar.gz |
|---|---|
| Size | 2.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb77951b256f476456c328ae94ec6043cb8f96efdc2d2ee97558c9fd9afd588a
|
|
BLAKE2b-256 checksum How to use checksums |
bcd808eee0ba63390006c0e98dec6dac84e4da08598a63830cc118455dc4f1f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8
|
Release files / flowiz-2.4.0-py3-none-any.whl
| Download URL | flowiz-2.4.0-py3-none-any.whl |
|---|---|
| Size | 2.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e6e8d862ac8e2433950d0cdb38a2d1ee00abfbe83dc7eca2ce41fdc2dd2f843
|
|
BLAKE2b-256 checksum How to use checksums |
a8f5846fb53f9f8c8586279033d1b83bebb65b2523a835394ef0ddedb8029728
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8
|
Security for flowiz 2.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.