{ "info": { "author": "George Gach", "author_email": "george@gach.space", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "
\n
\n
\n\n
\n\n\n\n\n\nConverts Optical Flow `.flo` files to images `.png` and optionally compiles them to a video `.mp4` via ffmpeg\n\n- [Installation](#installation)\n- [Usage](#usage)\n - [Command line usage](#command-line-usage)\n - [Python usage](#python-usage)\n - [GUI usage](#gui-usage)\n - [Help](#help)\n- [Acknowledgements](#acknowledgements)\n- [FAQ](#faq)\n- [To-Do](#to-do)\n\n## Installation\n\nGrab the latest package from PyPI repo\n\n```bash\npip install flowiz -U\n```\n\nor grab it straight from Github\n\n```bash\npip install git+https://github.com/georgegach/flowiz/\n```\n\nor clone the repo and install using `setup.py`\n\n```bash\ngit clone https://github.com/georgegach/flowiz.git\ncd flowiz\npython setup.py install --user\n```\n\nMake sure you have following packages installed\n\n```bash\npip install numpy tqdm pillow eel\napt install ffmpeg\n```\n\n## Usage\n\nPackage can be used both from the command line and python script.\n\n### Command line usage\n\nThe following script grabs `.flo` files from `./demo/flo/` directory and converts into `.png` saving in the same directory\n\n```bash\npython -m flowiz demo/flo/*.flo\n```\n\nYou can pass output directory for `.png` images via `-o` or `--outdir` parameter\n\n```bash\npython -m flowiz demo/flo/*.flo --outdir demo/png/\n```\n\nYou 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)\n\n```bash\npython -m flowiz demo/flo/*.flo -o demo/png --videodir demo/mp4\n```\n\nPass `-r` or `--framerate` parameter to control the framerate of compiled video\n\n```bash\npython -m flowiz demo/flo/*.flo -o demo/png -v demo/mp4 --framerate 2\n```\n\n### Python usage\n\nRelevant python code is available in `demo/test.ipynb` notebook. Here's an excerpt:\n\n```python\nimport flowiz as fz\n\nfiles = glob.glob('demo/flo/*.flo')\nimg = fz.convert_from_file(files[0])\nplt.imshow(img)\n```\n\n\n\nIn case you need to visualize `U V` channels separately from your numpy `floArray`:\n\n```python\nuv = fz.convert_from_flow(floArray, mode='UV')\naxarr[0].imshow(uv[...,0], cmap=plt.get_cmap('binary'))\naxarr[1].imshow(uv[...,1], cmap=plt.get_cmap('binary'))\n```\n\n\n\n### GUI usage\n\nBeta version of the `flowiz` graphical user interface is now accessible via `flowiz.gui` package. It is packaged using [ChrisKnott / Eel](https://github.com/ChrisKnott/Eel) and available via default web browser. To run the GUI simply type:\n\n```bash\npython -m flowiz.gui\n```\n\nUpon 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. \n\nMockup of the GUI is available at [georgegach.github.io/flowiz](http://georgegach.github.io/flowiz)\n\n\n\n### Help\n\n```bash\n$ python -m flowiz -h\n\nusage: __main__.py [-h] [--outdir OUTDIR] [--videodir VIDEODIR]\n [--framerate FRAMERATE]\n input [input ...]\n\npositional arguments:\n input Input file(s). (e.g.: __ ./demo/flo/*.flo)\n\noptional arguments:\n -h, --help show this help message and exit\n --outdir OUTDIR, -o OUTDIR\n Output directory path. Default: same directory as\n [.flo] files. (e.g.: __ -o ./demo/png/)\n --videodir VIDEODIR, -v VIDEODIR\n Compiles [.mp4] video from [.png] images if parameter\n is passed. Parameter requires video output directory\n path without a filename. (e.g.: __ -v ./demo/mp4/)\n --framerate FRAMERATE, -r FRAMERATE\n Frames per second of the video. (e.g.: __ -r 2)\n```\n\n## Acknowledgements\n\nThe library is based on Midlebury's Vision Project MATLAB code: