File Exchange

image thumbnail

Real time optical flow, and video processing

version 1.1 (3.81 MB) by

Real time optical flow, and video processing, with support for camera input in Matlab.

36 Downloads

Updated

View License

NOTE: this submission is obsolete. The version here:
http://www.mathworks.com/matlabcentral/fileexchange/44400-tutorial-and-toolbox-on-real-time-optical-flow
is in every sense better.
I leave this submission online, because it contains som MEX optimization in a streaming application that might be useful for some. Since Matlab incorporated JIT compilation, these mex optimizations are less effecient than doing it purely in Matlab, even with using openMP. Original description follows:

Start by running "runMe.m"

Supports input through:
a) synthetically generated test images
b) reading avi-file
c) camera input (requires image aquisition toolbox)

Calculates optical flow by 4 different local methods(all moment based), 2 implementations of Lucas and Kanade, and 2 implementations of point-line flow.

Can process easily hundreds of frames per second on a laptop for resolution 200x200 images.

Entirely implemented in Matlab, except for a small mex-module that calculates the gradient field. You can either download this mex binary here:

http://islab.hh.se/mediawiki/index.php/Stefan_Karlsson/PersonalPage

... or you can compile the code in the folder c-code. This has a script "make.m".

Comments and Ratings (16)

Stefan Karlsson

NOTE: this submission is obsolete. The version here:
http://www.mathworks.com/matlabcentral/fileexchange/44400-tutorial-and-toolbox-on-real-time-optical-flow is in every sense better.

Mammo Image

Hi,

why there is just one vector for the whole video, should not be for each frame.

also, I used getsavedflow (); to save the vectors for all frames but there is an error says no saved session initialized

TM Hoogland

Enes Çakar

Hello,

i want to detect outer lip contour and tracking in live. please let me know if there is any method that can solve my problem

Stefan Karlsson

@sachin,

1) folder c-code has a file make.m
2) for most purposes, you would probably be better off looking at my other optical flow submission, its a more stable implementation

sachin

sachin (view profile)

I am using Matlab R2013a , when i have runMe.m file , i have got error like please let me know how i can solve ???
Undefined function or variable 'Grad3D7do'.

Error in vidProcessing (line 87)
Grad3D7do();

Error in runMe (line 56)
vidProcessing(movieType, method,
spdFactor,bFineScale,nofTimeSlices);

Stefan Karlsson

@sameer

If you are interested in tracking lips contours a good thing to look into is active appearance models. These do not work so well for speech dynamics in realtime, but excellent for static emotion analysis. Works especially well if you have a view of the entire face.

Stefan Karlsson

For Matlab 2013, this version is now actually both faster, more stable and easier to use:

http://www.mathworks.com/matlabcentral/fileexchange/44400-tutorial-on-real-time-optical-flow

SAMEER ahamed

Hello,

   i want to detect outer lip contour and tracking . please let me know (in computer vision tool box possible to implement?).like reference from link http://islab.hh.se/mediawiki/index.php/Stefan_Karlsson/PersonalPage/ArticularyDynamics

Stefan Karlsson

@SAMEER,
This is the optimized module for calculating gradients. If you read the description for this submission, there is a URL where you can get a precompiled binary (that way you dont have to compile it yourself).

SAMEER ahamed

I am using Matlab R2013a , when i have runMe.m file , i have got error like please let me know how i can solve ???
Undefined function or variable 'Grad3D7do'.

Error in vidProcessing (line 87)
Grad3D7do();

Error in runMe (line 56)
vidProcessing(movieType, method,
spdFactor,bFineScale,nofTimeSlices);

Stefan Karlsson

@Avi, Thank you.

@xiangz, can you be more specific on the problem? Type some code that I can run, and describe the problem with the output. Thanks for your interest

Avi Nehemiah

Avi Nehemiah (view profile)

Thanks for the great submission, i really liked the approach of showing the different methods.

Information on some other optical flow methods and examples can be found at this link: http://www.mathworks.com/discovery/optical-flow.html

xiangz ?

It's really brilliant to put the five methods all together. It is more easily to compare.
But when I try the KL or the improvedKL, the "line motion (U2, V2)" was not sign in the function "DoFlow", certainly It won't run. Is there something I can do for that?

Updates

1.1

clarified description, this submission is obsolete.

1.1

Just clarified description text

MATLAB Release
MATLAB 7.10 (R2010a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video