Skip to main content

CUDA-accelerated volumetric optical flow estimation using the Farneback algorithm

Project description

https://badge.fury.io/py/farneback3d.svg https://travis-ci.org/theHamsta/farnback3d.svg?branch=master

A CUDA implementation of the Farneback optical flow algorithm [1] for the calculation of dense volumetric flow fields. Since this algorithm is based on the approximation of the signal by polynomial expansion it is especial suited for the motion estimation in smooth signals without clear edges.

To know more about the implementation, have a look on this OpenCV class that was used as a template for this implementation.

Development takes place on Github.

Python interface

The project uses pycuda to provide a pure-python package available on PyPi

pip install farneback3d

Usage:

import farneback3d

... # create some numpy volumes vol0 and vol1 (can also be pycuda GPUArrays)

# set parameters for optical flow (parameters have the same meaning as in the OpenCV implementation)
optflow = farneback3d.Farneback(
        pyr_scale=0.8,         # Scaling between multi-scale pyramid levels
        levels=6,              # Number of multi-scale levels
        num_iterations=5,      # Iterations on each multi-scale level
        winsize=9,             # Window size for Gaussian filtering of polynomial coefficients
        poly_n=5,              # Size of window for weighted least-square estimation of polynomial coefficients
        poly_sigma=1.2,        # Sigma for Gaussian weighting of least-square estimation of polynomial coefficients
    )

# calculate frame-to-frame flow between vol0 and vol1
flow = optflow.calc_flow(vol0, vol1)

C++ interface

To be implemented…

Future plans

The current implementation uses a naive approach to perform the necessary convolutions. The algorithm could be sped up drastically by performing separable convolutions along each coordinate axis.

References

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

farneback3d-0.1.3.tar.gz (33.4 kB view details)

Uploaded Source

File details

Details for the file farneback3d-0.1.3.tar.gz.

File metadata

  • Download URL: farneback3d-0.1.3.tar.gz
  • Upload date:
  • Size: 33.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for farneback3d-0.1.3.tar.gz
Algorithm Hash digest
SHA256 09869b7aeee27b7f8429496877c3d4ffcda325311887eda1aa95460910920572
MD5 bd144929d78f3f1feafd600e25589881
BLAKE2b-256 23136e737ef04cdde92849ed211fbe3e25640bf42ffb8f562eab39165664f5a8

See more details on using hashes here.

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