Git Product home page Git Product logo

pytyphoon's Introduction

PyTyphoon

Python implementation of Typhoon motion estimator: dense estimation of 2D/3D optical flow on wavelet bases, primarily aimed at fluid motion estimation.

Important remarks

At the moment, the wavelet-based data DFD term (Dérian et al., 2013) only is provided: the high-order regularizers (Kadri-Harouna et al., 2013) are not included in this implementation.

The reference implementation used in (Dérian et al., 2015) and (Dérian et al., 2017) is written in C++ and GPU-accelerated with CUDA, and contains the high-order regularizers. It is the property of Inria (FR) and the CSU Chico Research Foundation (Ca, USA), and can be licensed from these institutions. This Python implementation is not the same as the reference for many reasons, and it is obviously much slower.

Requirements

Tested with Anaconda Python 3.6.1, Numpy 1.12.1, Scipy 0.19.1, PyWavelet 0.5.2.

Usage

The Typhoon class can be imported from other modules/scripts to perform estimations as needed.

The script can also work as a standalone estimator in simple cases, e.g.:

python pytyphoon.py -i0 path/to/im0.jpg -i1 path/to/im1.jpg -wav 'db3' --display

will solve the problem for image pair (im0.jpg, im1.jpg) and wavelet Daubechies-3. See python pytyphoon.py -h for the complete list of parameters.

How does it work?

Typhoon solves a dense variational optical flow problem, that is to say: (i) it provides one motion vector at every pixel of input images and (ii) it estimates the entire vector field altogether.

To do so, it looks for the motion field which minimizes the displaced frame difference (DFD):

DFD

This is achieved by minimizing the following functional:

DFD functional

where the integral is taken over the image. The functional above is non-linear with respect to the motion field. This has the advantage of better handling large displacement, but complicates the minimization process.

For the non-linear minimization to succeed, the solution should lie reasonable "close" to the first guess. This is where wavelets bases come into play: by providing a multiscale representation of the motion field, they enable to estimate the motion iteratively from its coarsest scales to the finests.

The minimization is handled by L-BFGS, which is efficient memory-wise and only requires the functional value and its gradient.

Demos

These demos are shipped with the project.

(2D) Synthetic particle images

Simple 2d estimation using synthetic particle images (256x256 pixels) originally created for the FLUID project (image database #1). Run:

python pytyphoon.py --demo particles

Particle results

(3D) Homogeneous shift

Simple 3d estimation using synthetic images (64x64x64 pixels) obtained by filtering random normal noise at various scales. The displacements are integer shifts along each of the 3 dimensions. Run:

python pytyphoon.py --demo 3dshift

3dshift results

(3D) Column vortex

Simple 3d estimation using synthetic images (96x96x96 pixels) obtained by filtering random normal noise at various scales. The displacement field is a column vortex (first two axes) with an updraft increasing linearly along the third axis. Run:

python pytyphoon.py --demo 3dvortex

3dshift results

References

  • (Dérian et al., 2017) Dérian, P. & Almar, R. "Wavelet-based Optical Flow Estimation of Instant Surface Currents from Shore-based and UAV Video". IEEE Transactions on Geoscience and Remote Sensing, Vol. 55, pp. 5790-5797, 2017.
  • (Dérian et al., 2015) Dérian, P.; Mauzey, C. F. and Mayor, S. D. "Wavelet-based optical flow for two-component wind field estimation from single aerosol lidar data". Journal of Atmospheric and Oceanic Technology, Vol. 32, pp. 1759-1778, 2015.
  • (Dérian et al., 2013) Dérian, P.; Héas, P.; Herzet, C. & Mémin, E. "Wavelets and Optical Flow Motion Estimation". Numerical Mathematics: Theory, Method and Applications, Vol. 6, pp. 116-137, 2013.
  • (Kadri-Harouna et al., 2013) Kadri Harouna, S.; Dérian, P.; Héas, P. and Mémin, E. "Divergence-free Wavelets and High Order Regularization". International Journal of Computer Vision, Vol. 103, pp. 80-99, 2013.

Todo

  • NetCDF for output results? in standalone mode;
  • support of masks;
  • some regularizers;
  • alternative penalization functions;
  • divergence-free wavelets;
  • ...

pytyphoon's People

Contributors

pderian avatar pderian-cea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pytyphoon's Issues

Lagrangian Regularization Question

Salut Derian!

Thanks so much for providing this code! I've been using it to get my head around a lot of concepts in your thesis and its helped a lot.

I've used the connection coefficients function to compute the Laplacian regularization and have gotten nice results.

I had a question regarding the test of the regularization schemes that you have coded in the demo (L1 & Horn Schunk). My question is regarding the computation of the regularization term in physical space versus wavelet space and the comparison of their values with respect to the formula for the laplacian:

image

Are you expecting exact agreement between these two terms for every level of the transform, or is some error acceptable? Additionally, do you expect this agreement to get much better for a wavelet basis with a much higher number of vanishing moments?

Thanks in advance!

minimal 3d optical flow example

Hello @pderian and thanks for sharing the code of your research!!

I was wondering if you can provide a minimal example for 3d dense optical flow estimation

I am curious to apply your approach in volumetric medical images. Do you think it is possible?

Best regards,

N.A.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.