
Machine Vision
TOOLBOX
Release 2 for use with MATLAB
Peter I. Corke

Peter I. Corke
mex- files are based on code which was part of the package
VISTA Copyright 1993, 1994 University of British Columbia.

3
Preface
1 Introduction
The Machine Vision Toolbox (MVT) provides many functions that are useful in
machine vision and vision-based control. It is a somewhat eclectic collection re-
flecting the author’s personal interest in areas of photometry, photogrammetry,
colorimetry. It includes over 90 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 process-
ing 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 im-
prove efficiency, however some algorithms are not amenable to vectorization. If
you have the Matlab compiler available then this can be used to compile bottle-
neck functions. Some particularly compute intensive functions are provided as
Machine Vision Toolbox Release 2 Copyright (c) Peter Corke 2005

4
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 ex-
travagant 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. It was developed under Unix and Linux
systems and some functions rely on tools and utilities that exist only in that
environment.
1.1 How to obtain the Toolbox
The Machine Vision Toolbox is available subject to the License Agreement from
the Toolbox home page at
http://www.petercorke.com
The files are available in either gzipped tar format (.gz) or zip format (.zip). The
web page requests some information from you regarding such as your country,
type of organization and application. This is just a means for me to gauge
interest and to help convince myself that this is a worthwhile activity.
2 Support
No support is provided. The author is happy to correspond with people who have
found genuine bugs or deficiencies, and to accept contributions for inclusion in
future versions of the toolbox, and you will be suitably acknowledged.
I can’t guarantee that I respond to your email and I will junk any requests
asking for help with assignments or homework.
3 Right to use
Use of the Toolbox is subject to the License Agreement. Many people are using
the Toolbox for teaching and this is something that the author encourages. If
Machine Vision Toolbox Release 2 Copyright (c) Peter Corke 2005

5
you plan to duplicate the documentation for class use then every copy must
include the front page.
If you want to cite the Toolbox please use
@article{Corke05f,
Author = {P.I. Corke},
Journal = {IEEE Robotics and Automation Magazine},
Title = {Machine Vision Toolbox},
Month = nov,
Volume = {12},
Number = {4},
Year = {2005},
Pages = {16-25}
}
or
"Machine Vision Toolbox", P.I. Corke, IEEE Robotics and Au-
tomation Magazine, 12(4), pp 16–25, November 2005.
which is also given in electronic form in the CITATION file.
3.1 Acknowledgments
This release includes functions for computing image plane homographies and
the fundamental matrix, contributed by Nuno Alexandre Cid Martins of I.S.R.,
Coimbra.
4 MATLAB version issues
The Toolbox works with MATLAB version 6 and later. It has been developed
and tested under Suse Linux and Mac OS 10.3. It has not been tested under
Windows.
Machine Vision Toolbox Release 2 Copyright (c) Peter Corke 2005