Code Monkey home page Code Monkey logo

cv_opt_flow's Introduction

OpenCV OpticalFlow Showcase

About

This is a sample code of Optical Flow casually with OpenCV.

This is better version of 'samples/python2/opt_flow.py' included in OpenCV:

  • Switchable to 4 types of optical flow methods,
  • Not accumulating 'flow' for making it easy,
  • Flipping video image horizontally for the use with webcam,
  • Packing each methods into classes,
  • Also runs on Raspberry Pi.

Example

  • Gunnar-Farneback method: By HSV

HSV HSV SRC

  • Gunnar-Farneback method: By lines

LINES LINES SRC

  • Gunnar-Farneback method: By warping

WARP WARP SRC

  • Lucas-Kanade method

Lucas-Kanade

Tested Environment

(Mac)

  • MacOS X El Capitan
  • python 2.7.10 & 3.6.2
  • OpenCV3 3.1.0 & 3.4.1

(Raspberry Pi)

  • Raspberry Pi 2
  • Ubuntu 14.04.4 LTS (trusty)
  • python 2.7.6
  • OpenCV3 3.0.0

Running this sample

For Mac/PC, simply run main.py.

$ python main.py

For Raspberry Pi, run raspi_main.py.

$ python raspi_main.py

Usage will be shown as below.

Hit followings to switch to:
1 - Dense optical flow by HSV color image (default);
2 - Dense optical flow by lines;
3 - Dense optical flow by warped image;
4 - Lucas-Kanade method.

Hit 's' to save image.

Hit 'f' to flip image horizontally.

Hit ESC to exit.
  • For Mac/PC, click on the preview window to enter commands.

About code

file description
main.py Main program to run this sample.
raspi_main.py Main program for Raspberry Pi.
OpticalFlowShowcase.py Optical flow sample body.

OpticalFlowShowcase.py has following classes.

Class diagram

cv_opt_flow's People

Contributors

daisukelab 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  avatar

Watchers

 avatar  avatar

cv_opt_flow's Issues

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.