Code covered by the BSD License  

Highlights from
Optical flow based robot obstacle avoidance with Matlab

4.0

4.0 | 1 rating Rate this file 26 Downloads (last 30 days) File Size: 214.52 KB File ID: #22713
image thumbnail

Optical flow based robot obstacle avoidance with Matlab

by Alexander Grau

 

18 Jan 2009 (Updated 24 Jan 2009)

Navigate a virtual robot in a virtual environment to avoid obstacles by using optical flow field.

| Watch this File

File Information
Description

Matlab’s Virtual Reality toolbox makes it possible to not only visualize a virtual world, but also capture it into an image from a specified position, orientation and rotation. The virtual world was created in VRML with a plain text editor and it can be viewed in your internet browser if you have installed a VRML viewer.

For calculating the optical view field of two successive camera images, I used a C optimized version of Horn and Schunk’s optical flow algorithm.

Based on this optical flow field, the flow magnitudes of right and left half of each image is calculated. If the sum of the flow magnitudes of the view reaches a certain threshold, it is assumed there is an obstacle in front of the robot. Then the computed flow magnitude of right and left half image is used to formulate a balance strategy: if the right flow is larger than the left flow, the robot turns left - otherwise it turns right.

Requires Matlab (Windows, Mac or Linux).

Note: On Mac or Linux, first the Matlab wrapper needs to be compiled into a mex file using Matlab by going to the directory containing the library and running the following command within Matlab:

mex OpticalFlowMatlab.cpp

Start the robot simulation by typing in Matlab:

ofnav

Required Products Simulink 3D Animation
Image Processing Toolbox
MATLAB release MATLAB 7.6 (R2008a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
05 Mar 2009 Syed Noman Hussain  
Please login to add a comment or rating.
Updates
20 Jan 2009

Deleted Mex file

24 Jan 2009

Added additional Product Requirement "Image Processing Toolbox" , it was missing in the initial submit.

Tag Activity for this File
Tag Applied By Date/Time
virtual reality Alexander Grau 20 Jan 2009 15:45:10
optical flow Alexander Grau 20 Jan 2009 15:45:10
computer vision Alexander Grau 20 Jan 2009 15:45:10
robot simulation Alexander Grau 20 Jan 2009 15:45:10
virtual robot Alexander Grau 20 Jan 2009 15:45:11

Contact us at files@mathworks.com