Code covered by the BSD License  

Highlights from
Affine optic flow

4.75
4.8 | 4 ratings Rate this file 55 Downloads (last 30 days) File Size: 500 KB File ID: #27093 Version: 1.3
image thumbnail

Affine optic flow

by

David Young (view profile)

 

26 Mar 2010 (Updated )

Estimates the parameters of an affine (first-order) optic flow model from two images.

| Watch this File

File Information
Description

An affine (or first-order) optic flow model has 6 parameters, describing image translation, dilation, rotation and shear. The class affine_flow provides methods to estimates these parameters for two frames of an image sequence.

The class implements a least-squares fit of the parameters to estimates of the spatial and temporal grey-level gradients. This is an extension of the well-known Lucas-Kanade method. The images are either sampled conventionally, on a rectilinear grid, or on a log-polar grid. In the latter case, the class may iteratively refine its estimates by moving the sampling grid to track the motion. Options to specify a region of interest and smoothing and sampling parameters are provided.

The file includes a demonstration of the class, and test images for this. The functions for smoothing images and estimating gradients may be useful independently, and log-polar sampling functions are included (and are available separately in submission 27023).

Acknowledgements

Log Polar Image Sampling, Extended Array Indexing, and Gradients With Gaussian Smoothing inspired this file.

This file inspired Muscle Fascicle Tracking Ultrasound.

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.10 (R2010a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (9)
17 Jan 2015 paperboat

Can you please provide any reference upon which this work is based? It will be very helpful for me. Thanks

21 Oct 2013 David Young

David Young (view profile)

Avi: Thank you. And yes, I would always recommend trying the MathWorks toolbox first if it is available.

Comment only
21 Oct 2013 Avi Nehemiah

Avi Nehemiah (view profile)

Thanks for the great submission.

The Computer Vision System Toolbox now includes optical flow in MATLAB.

Check out this link for information and code examples on optical flow: http://www.mathworks.com/discovery/optical-flow.html

26 Oct 2011 Michael

Michael (view profile)

Works great!

27 Jan 2011 David Young

David Young (view profile)

The Matlab OOP capabilities were introduced with version 2008a, so yes, I think it should work with 2009a. It's worth trying, and if there are problems they should be minor ones that can be fixed. For example you may need to replace '~' as an unused argument or result with a variable name such as 'unused'.

Comment only
26 Jan 2011 Alfian Abdul Halin

The time I ran this I was using MATLAB 2007... you think it might work if I use R2009a?

Comment only
28 Aug 2010 David Young

David Young (view profile)

Alfian: What Matlab version are you using? It may be the problem: this class uses the fairly recent Matlab OO system, and was tested in version 2010a.

Comment only
25 Aug 2010 Alfian Abdul Halin

Hi. I tried to run the demo code (with Jpeg images)... and got this error (but i think its not due to the jpegs)...

??? Error: File: affine_flow.m Line: 1 Column: 10
A class definition must be in an "@" directory.

Comment only
07 Jul 2010 Glen Lichtwark

Glen Lichtwark (view profile)

 
Updates
30 Mar 2010 1.1

Fixed bug in use of ROI, allowed ROI in conjunction with log-polar sampling, simplified gradient computation by using exindex, minor changes to demo.

09 May 2010 1.2

Changed from a function to a class, for more efficient application to image sequences. (Argument checking etc. can be moved outside a loop, and some intermediate computations can be saved for later use.)

09 Dec 2011 1.3

Fixed bug which caused error when sample step was greater than 1.

Minor corrections to comments.

Changed order of arguments in gsmooth2 and gradients_xyt.

Contact us