Journal of Open Research Software (Nov 2021)

oflibnumpy & oflibpytorch: Optical Flow Handling and Manipulation in Python

  • Claudio S. Ravasio,
  • Lyndon Da Cruz,
  • Christos Bergeles

DOI
https://doi.org/10.5334/jors.380
Journal volume & issue
Vol. 9, no. 1

Abstract

Read online

We present oflibnumpy and oflibpytorch, an optical flow library based on NumPy arrays and PyTorch tensors, respectively. It provides a structured approach to the representation of optical flow, i.e '2'D vector fields, as a custom class offering a number of methods to apply, manipulate, analyse, and visualise the flow. The library takes into account the two possible frames of reference in optical flow calculation, namely the source (first frame) and target (second frame). The collection of methods and their rigorous mathematical underpinning makes the library broadly applicable to any project that uses flow fields. It is implemented as a Python 3 package whose source can be found on GitHub, and which can be installed either from the git repository or the Python Package Index (PyPI).

Keywords