Machine Vision Toolbox

Introduction

This, the fourth release of the Toolbox, represents over two decades of development. This version captures a large number of changes and extensions to support the second edition of my book “Robotics, Vision & Control”.

The Machine Vision Toolbox (MVTB) provides many functions that are useful in machine vision and vision-based control.  It is a somewhat eclectic collection reflecting my personal interest in areas of photometry, photogrammetry, colorimetry.  It includes over 100 functions spanning operations such as image file reading and writing, acquisition, display, filtering, blob, point and line feature extraction,  mathematical morphology, homographies, visual Jacobians, camera calibration and color space conversion.

The Toolbox, combined with MATLAB ® and a modern workstation computer, is a useful and convenient environment for investigation of machine vision algorithms.  For modest image sizes the processing rate can be sufficiently “real-time” to allow for closed-loop control.  Focus of attention methods such as dynamic windowing (not provided) can be used to increase the processing rate.  With input from a firewire or web camera (support provided) and output to a robot (not provided) it would be possible to implement a visual servo system entirely in MATLAB

An image is usually treated as a rectangular array of scalar values representing intensity or perhaps range.  The matrix is the natural datatype for MATLAB and thus makes the manipulation of images easily expressible in terms of arithmetic statements in MATLAB language.  Many image operations such as thresholding, filtering and statistics can be achieved with existing MATLAB functions.

The Toolbox extends this core functionality with M-files that implement functions and classes, and mex-files for some compute intensive operations.  It is possible to use mex-files to interface with image acquisition hardware ranging from simple framegrabbers to robots. Examples for firewire cameras under Linux are provided.

The routines are written in a straightforward manner which allows for easy understanding.  MATLAB vectorization has been used as much as possible to improve efficiency, however some algorithms are not amenable to vectorization.  If you have the MATLAB compiler available then this can be used to compile bottleneck functions.  Some particularly compute intensive functions are provided as mex-files and may need to be compiled for the particular platform.  This toolbox considers images generally as arrays of double precision numbers.  This is extravagant on storage, though this is much less significant today than it was in the past.

This toolbox is not a clone of the Mathwork’s own Image Processing Toolbox (IPT) although there are many functions in common. This toolbox predates IPT by many years, is open-source, contains many functions that are useful for image feature extraction and control.

The Toolbox contains numerous classes to represent different types of cameras (perspective, fisheye, catadioptric and spherical), and functionality for pose estimation, visual Jacobians and advanced segmentation techniques such as MSER and graph-based.  The Toolbox also including Simulink models for PBVS and IBVS visual servoing systems for arm-type, mobile and flying robots.

Advantages of the Toolbox are that:

  • the code is quite mature and provides a point of comparison for other implementations of the same algorithms;
  • the routines are generally written in a straightforward manner which allows for easy understanding, perhaps at the expense of computational efficiency. If you feel strongly about computational efficiency then you can always rewrite the function to be more efficient, compile the M-file using the Matlab compiler, or create a MEX version;
  • since source code is available there is a benefit for understanding and teaching.

Installing the Toolbox

There are two versions of the Machine Vision Toolbox:

  • MVTB3.4, the last in the 3rd release is what is used in Robotics, Vision & Control (1st edition) and the Robot Academy.
  • MVTB4.x is the current release and is used in Robotics, Vision & Control (2nd edition)

both are available for installation using one of three installation methods:

  1. Direct access to a shared MATLAB Drive folder (for MATLAB19a onward)
  2. Download a MATLAB Toolbox install file (.mltbx type)
  3. Download a zip file and manually install

Install from shared MATLAB Drive folder

Note that this includes the Robotics Toolbox (RTB) as well.

  1. Click on the appropriate link to receive an invitation to share:
  2. A folder named RVC1  or RVC2 will appear in your MATLAB drive
  3. Using the MATLAB file browser to navigate to the folder RVCx/rvctools and double-click the script named startup_rvc.m

Install from .mltbx file

  1. Download  the following files
  2. From within the MATLAB file browser double click on this file, it will install and configure the paths correctly

MVTB-4.3


3rd party functions

Download and unpack this zip file which provides the 3rd part code to support the isift and isurf functions in the Toolbox.

contrib2

This will unpack into  a folder called rvctools/contrib which you will need to add to your MATLAB path.


Images

Any image in the book can be downloaded from the URL https://petercorke.com/files/images/IMAGENAME where IMAGENAME is as per the book and includes the file extension, eg.

http://www.petercorke.com/files/images/flowers6.png

images for RVC2

Images for RVC2 (extra image sequences for Ch 14)


Documentation

  • The book Robotics, Vision & Control, second edition (Corke, 2017)  is a detailed introduction to color, image geometry, image processing, feature extraction, multi-view geometry and vision-based control, all illustrated using the Machine Vision Toolbox for MATLAB.
  • The manual robot.pdf (7.5 MB) is a PDF file is a printable document (over 400 pages).  It is auto-generated from the comments in the MATLAB code and is fully: to external web sites, the table of content to functions, and the “See also” functions to each other.  You can find this in the Toolbox as rvctools/vision/vision.pdf
  • The Toolbox documentation also appears in the MATLAB help browser.

Related publications

If you like the Toolbox and want to cite it please reference it as:

  • P.I. Corke, “Robotics, Vision & Control”, Springer 2011, ISBN 978-3-642-20143-1.  [bibtex]

The following are now quite old publications about the Toolbox and the syntax has changed considerably over time:

  • P. Corke. Machine vision toolbox. IEEE Robotics and Automation Magazine, 12(4):16–25, Nov. 2005. [PDF]
  • P.I. Corke, “MATLAB toolboxes: robotics and vision for students and teachers”, IEEE Robotics and Automation Magazine, Volume 14(4), December 2007, pp. 16-17 [PDF]

Support

There is no support!  This software is made freely available in the hope that you find it useful in solving whatever problems you have to hand. I am happy to correspond with people who have found genuine bugs or deficiencies but my response time can be long and I can’t guarantee that I respond to your email.  I am very happy to accept contributions for inclusion in future versions of the toolbox, and you will be suitably acknowledged.

I can guarantee that I will not respond to any requests for help with assignments or homework, no matter how urgent or important they might be to you.  That’s what your teachers, tutors, lecturers and professors are paid to do.

You might instead like to communicate with other users via the Google Group called which is a forum for discussion.  You need to signup in order to post, and the signup process is moderated by me so allow a few days for this to happen.  I need you to write a few words about why you want to join the list so I can distinguish you from a spammer or a web-bot.

There is also a frequently asked questions (FAQ) wiki page.

The Toolbox will not work with Octave.  I like Octave and it is now quite sophisticated but there are just too many differences compared to vanilla MATLAB.  You’re on your own with this.


History

The machine vision toolbox developed slowly during the 1990s to assist in research related to visual servoing.  The first release was in 1999, and the second in 2005 to coincide with a paper.

During the writing of the Robotics, Vision & Control (1st edition) the code grew in size and sophistication and made increasing use of classes for cameras and image features.

The fourth release of the Toolbox consolidates a number of smaller changes and matches Robotics, Vision & Control (2nd edition).