Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript Optical Flow Implementation

I'm looking for an optical flow implementation to run on my web app in html5 canvas, but didn't found something immediately usable. If I choose to implement it by myself, is it be possible to achieve (near) real-time performance?

Or, since in the current setting, I actually just want to know the main optical flow is moving to the left or right, are there some easier algorithms I can use?

like image 885
clwen Avatar asked Nov 05 '12 16:11

clwen


People also ask

What is optical flow?

Optical flow is the pattern of apparent motion of image objects between two consecutive frames caused by the movement of object or camera. It is 2D vector field where each vector is a displacement vector showing the movement of points from first frame to second. Consider the image below (Image Courtesy: Wikipedia article on Optical Flow ).

What is the use of optical flow in OpenCV?

It is used to find corners in the image and then calculate the corners’ motion vector between two consecutive frames. OpenCV has the implementation of Pyramid Lucas & Kanade with Shi-Tomasi algorithm improvement to calculate the Optical Flow.

What is optical flow in action recognition?

Also, Optical Flow finds its application in Action Recognition tasks and real-time tracking systems. There are two types of Optical Flow, and the first one is called Sparse Optical Flow. It computes the motion vector for the specific set of objects (for example – detected corners on image).

How to create a dense optical flow field using CV?

We will create a dense optical flow field using the cv.calcOpticalFlowFarneback () method. Optical flow is the pattern of apparent motion of image objects between two consecutive frames caused by the movement of object or camera.


2 Answers

I made this little library which does (I hope) exactly what you are asking for.

A demo Which utilizes this library to control the ball by moving your hands.

like image 197
Anvaka Avatar answered Sep 29 '22 02:09

Anvaka


I made a real time feature tracking that can generate sparse optical flow and point trajectories. It uses asm.js, so it runs faster on firefox (50ms per 320x240 frame - 1500 points)

www.ensta-paristech.fr/~garrigues/js_tracking/javascript_video_tracking.html

like image 37
Matthieu G Avatar answered Sep 29 '22 02:09

Matthieu G