View License

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

» Watch video

Highlights from
Real time optical flow, and video processing

4.8
4.8 | 5 ratings Rate this file 34 Downloads (last 30 days) File Size: 3.81 MB File ID: #40968 Version: 1.1
image thumbnail

Real time optical flow, and video processing

by

Stefan Karlsson (view profile)

 

27 Mar 2013 (Updated )

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

| Watch this File

File Information
Description

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".

MATLAB release MATLAB 7.10 (R2010a)
MATLAB Search Path
/
/OpenSourceVidProcessing
/OpenSourceVidProcessing/c-code
Other requirements in order to compile the mex files, you will need "openMP". Should compile without it, but you will get slower speed for the gradient calculations. Try the precompiled binaries at my homepage in that case.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (16)
06 Sep 2016 Stefan Karlsson

Stefan Karlsson (view profile)

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.

Comment only
29 Aug 2016 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

Comment only
17 Feb 2016 Abouzar Moshfegh

29 Jun 2015 TM Hoogland

20 Jun 2015 Enes Çakar

29 Apr 2015 ibrahim zeleke

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

Comment only
05 Oct 2014 Stefan Karlsson

Stefan Karlsson (view profile)

@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

Comment only
30 Jul 2014 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);

Comment only
27 Nov 2013 Stefan Karlsson

Stefan Karlsson (view profile)

@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.

Comment only
27 Nov 2013 Stefan Karlsson

Stefan Karlsson (view profile)

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

Comment only
25 Nov 2013 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

Comment only
20 Nov 2013 Stefan Karlsson

Stefan Karlsson (view profile)

@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).

Comment only
12 Nov 2013 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);

Comment only
31 Oct 2013 Stefan Karlsson

Stefan Karlsson (view profile)

@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

Comment only
21 Oct 2013 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

23 Sep 2013 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
28 Mar 2013 1.1

Just clarified description text

22 Nov 2015 1.1

clarified description, this submission is obsolete.

Contact us