Optical flow library using a custom flow class based on NumPy arrays
Project description
Oflibnumpy: a handy python optical flow library, based on NumPy arrays, that enables the manipulation and combination of flow fields while keeping track of valid areas (see “Usage”). It is mostly code written from scratch, but also contains useful wrappers for specific functions from libraries such as OpenCV’s remap, to integrate them with the custom flow field class introduced by oflibnumpy. Features:
Provides a custom flow field class for both backwards and forwards (‘source’ / ‘target’ based) flow fields
Provides a number of class methods to create flow fields from lists of affine transforms, or a transformation matrix
Provides a number of functions to resize the flow field, visualise it, warp images, find necessary image padding
Allows for three different types of flow field combination operations
Keeps track of valid flow field areas through said operations
Note there is an equivalent flow library called Oflibpytorch, mostly based on PyTorch tensors. Its code is available on Github, and the documentation is accessible on ReadTheDocs.
Usage & Documentation
A user’s guide as well as full documentation of the library is available at ReadTheDocs. Some quick examples:
import oflibnumpy as of
# Make a flow field and display it
shape = (300, 400)
flow = of.Flow.from_transforms([['rotation', 200, 150, -30]], shape)
flow.show()
# Combine sequentially with another flow field, display the result
flow_2 = of.Flow.from_transforms([['translation', 40, 0]], shape)
result = of.combine_flows(flow, flow_2, mode=3)
result.show(show_mask=True, show_mask_borders=True)
result.show_arrows(show_mask=True, show_mask_borders=True)
Installation
Oflibnumpy is based on Python>=3.7. Install it by running:
pip install oflibnumpy
Contribution & Support
Source Code: https://github.com/RViMLab/oflibnumpy
Issue Tracker: https://github.com/RViMLab/oflibnumpy/issues
License
Copyright (c) 2021 Claudio S. Ravasio, PhD student at University College London (UCL), research assistant at King’s College London (KCL), supervised by:
Dr Christos Bergeles, PI of the Robotics and Vision in Medicine (RViM) lab in the School of Biomedical Engineering & Imaging Sciences (BMEIS) at King’s College London (KCL)
Prof Lyndon Da Cruz, consultant ophthalmic surgeon, Moorfields Eye Hospital, London UK
This code is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for oflibnumpy-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd2127153b8b8928617dcdd827006acd237e389a7011c9b7bf5dd0e4bf447109 |
|
MD5 | 34f6364c2003d39f27bdab8ed2bdcaf1 |
|
BLAKE2b-256 | 03893e1b3187cf50f50d8753f5e71df8511b57c6d877fac3a75031cd4aa8bdb6 |