Optical flow based robot obstacle avoidance with Matlab
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
Zitieren als
Alexander Grau (2024). Optical flow based robot obstacle avoidance with Matlab (https://www.mathworks.com/matlabcentral/fileexchange/22713-optical-flow-based-robot-obstacle-avoidance-with-matlab), MATLAB Central File Exchange. Abgerufen .
Kompatibilität der MATLAB-Version
Plattform-Kompatibilität
Windows macOS LinuxKategorien
- Simulink > Simulation >
- Image Processing and Computer Vision > Computer Vision Toolbox > Tracking and Motion Estimation > Motion Estimation >
- Robotics and Autonomous Systems > Robotics System Toolbox >
- MATLAB > Graphics > Formatting and Annotation > 3-D Scene Control > Camera Views >
- Engineering > Electrical and Computer Engineering > Optics >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
src/
Version | Veröffentlicht | Versionshinweise | |
---|---|---|---|
1.3.0.0 | Added additional Product Requirement "Image Processing Toolbox" , it was missing in the initial submit. |
||
1.2.0.0 | Deleted Mex file |
||
1.0.0.0 |