Imageprocessingusing Matlab
Imageprocessingusing Matlab
and scientific circles for numeric intensive computing. There are using the 40 MHz TMS320C25 for filtering occur at over 40
many toolboxes available, the DSP toolbox & others in areas of times the speed of Matlab on a 12 MHz PC-AT with a
optimization, spline, control and estimation, and system
floating-point coprocessor. A 20 minute Matlab computation,
identification. There are some useful functions in the DSP toolbox
for 2-dimensional signal processing: 2-D DFT’s, convolution,
such as convolving or transforming a large image, might
correlation, and graphing. Separable and non separable therefore be done in as little as 30 seconds, depending upon
processing is conveniently described in terms of matrices. Also how much inter-processor communication and other overhead
many topics in image enhancement and restoration are is involved. A 6 function library of useful object-code C25
conveniently described in terms of matrices. PC-Matlab is a very functions will be described in which the functions can be
convenient tool for processing small images or blocks, 64 x 64 invoked entirely from within Matlab. Depending upon the
often being an upper limit for processing, although larger blocks amount of Matlab intervention, e.g., data transfers into and out
can be imported and displayed. In spite of these restrictions, it is of Matlab, accelerations of an appreciable fraction of the
possible to display and process full size 600 x 800 images using maximum are attainable. The acceleration by itself is not the
PC Matlab and a graphics processor. The signal processor adds
the possibility of accelerating numeric intensive operations by a
only or even the main time saver, though, since the ability to
factor of 10 to 40. prepare simple Matlab code for controlling complex
experiments and evaluating the results with numerically
In this paper, some methods of augmenting Matlab with accurate Matlab functions and graphing them, all in an
programmable DSP’s and graphics processors are described interpretive environment, provides acceleration of the
which provide the mentioned capability for fast processing, fixed- algorithm development and test process.
point and binary representation and manipulation, and image
display. These capabilities are attained by using three separate The following 6 functions are quite general and can be used to
processors, the Texas Instruments (TI) TMS320C25 fixed-point
utilize the C25 for both 1- and 2-dimensional algorithms. It is
DSP, the TMS34010 graphics processor, and a PC-AT. In
addition, we are using Super VGA (600 X 800 pixel) monochrome
assumed that a set of useful C25 assembly language programs
monitors. The two T.I. processors are widely available from is available and ready for downloading to the C25. A function
many suppliers for many PC’s and engineering workstations, but for doing this and functions for initialization of the C25 and
we are using TI expansion slot boards for PC-AT compatibles. down and uploading data are described below.
The functions in the two toolboxes are a sufficient starting point
for image processing. They can be used to write Matlab script tms_init (mc)
functions for 2-D filtering, multi resolution processing, etc. These
functions can be further accelerated with additional toolbox This routine determines if the system is AT or XT and
functions which directly link the two processors, an activity in
initializes memory appropriately. Then its resets and holds the
progress.
C25 in readiness for loading a program and input data.
I. INTRODUCTION
tms_load (filename)
Image-processing workstations of the described configuration
This routine loads the assembled code to the C25’s program
have several advantages over conventional workstations based
memory. Either T. I. tagged or COFF object code may be
upon engineering workstations: (1) they are relatively
used. The program name is an argument.
inexpensive (we have a 16 station laboratory at Rutgers of this
tms_wdm (x, dat_addr)
configuration for undergraduate and graduate use obtained at
This routine downloads integer data to the C25 starting at the
relatively small cost), (2) they contain high performance DSP
specified address. Both parameters (size, etc.) and data vectors
and graphics processors (the latter being similar to engineering
may be downloaded with this.
workstation graphics processors), (3) they are flexible,
reconfigurable, and updatable, (4) the hardware and software
load_flt (h, data_addr)
are easily accessed and used by the investigator, (5) the
memory limitations of PC Matlab and DOS are consistent with
This routine downloads floating point data, such as filter
practical hardware systems, encouraging the development of
coefficients, to the C25 after converting them from
practical, block-processing algorithms, (6) the availability of a
MATLAB’s double precision floating point to integer (Q15)
large variety of relevant expansion slot boards, frame
format. Often this data is normalized to be in the range -1 to
grabbers, etc. and software, at low cost, and (7) the relative
+l.
ease of integrating the host PC as well as the boards into real-
time processing experiments.
tms_run
II. THE TMS320C25 TOOLBOX
This routine releases the C25 from hold starting the C25 at the many numerically intensive algorithms, is a particularly
address in the program counter, normally zero, the value appropriate application for the C25.
determined by reset.
III. THE TMS34010 TOOLBOX
tms_rdm (N, data_addr)
The remainder of the interface consists of functions for image
This routine reads N words from the C25 memory starting processing and display which make use of the TMS34010
from data_addr, and converts them to Matlab format and graphics processor for display and as a frame buffer. A typical
uploads them. situation is one in which one or more binary files for large
images say 640 x 480 or 512 x 512 pixels are available. It is
Example desired to display, process, reformat, and/or print these
images. Three functions are available for up and downloading
A sample experiment in which an FIR filter is designed, an complete images between files and the graphics processor.
input is generated, both a Matlab and a C25 result are They are very efficient and, after the processor is initialized,
obtained, the latter is uploaded to Matlab, and they are both require only 6 seconds for display or file writing. A fourth
displayed on the same graph is described below. All of these function writes the displayed image from the graphics
steps can be performed using the preceding 6 basic functions processor to a postscript file for printing. The arguments of
in the interface. They can be invoked from Matlab either these four functions are entered on the command line. Two
interactively (not under control of a program) or from a script remaining functions enable blocks, typically 64 x 64, to be
file, such as that illustrated below. The result of running this moved between Matlab and the graphics processor, thus
script from Matlab is a plot of the two results, as the last two permitting the creation and editing of blocks in Matlab. The
lines indicate. There are slight, but noticeable, differences in functions are described below, and monochrome images are
the two results due to quantization in the C25. assumed:
gp2ml(x, start)
Examples
Discussion
The functions in the two toolboxes described above are a Figure 2 An Artificial 64 x 64 Image Created in Matlab, Printed in Two
sufficient starting point for image processing. They can be Postscript-Prescribed Scales.
used to write Matlab script functions for 2-D filtering, multi
resolution processing, etc. These functions can be further
accelerated with additional toolbox functions which directly
link the two processors, an activity in progress.
REFERENCES
[1] Digital Signal Processing using Matlab by Vinay K. Ingle & John G.
Proakis, 2007 Thomson Learning
[2] Fundamentals of Digital Signal Processing using Matlab by Robert J.
Schilling & Sandra L. Harris,2007, Thomson Learning
[3] Proakis, J.G. & Manolakis, D.G.,” Digital Signal Processing: Principles
Algorithms and Applications”, Prentice Hall of India.
[4] Digital Signal processing a practical approach by Emmanuel C. Ifeachor &
Barrie W. Jervis, 2004, Pearson Education
[5] Digital Image Processing Second Edition by Rafael C. Gonzalez &
Richard E. Woods , 2002, Pearson Education
[6] Fundamentals of Digital Image Processing by Anil Kumar Jain, 2001, PHI
[7] Oppenheim A.V., Schafer, Ronald W. & Buck, John R.,”Discrete Time
Signal processing”, Pearson Education ,2nd Edition
[8] Oppenheim, Alan V. & Willsky, Alan S., “Signals and Systems”, Prentice
Hall of India, 2nd Edition
[9]T. G. Marshall, Jr. and H.-Y Kim, "A MATLAB/SWDS environment for
TMS320C25 algorithm development, Proc. TMS320 Educators Conf,"
Houston TX, July, 1991