3.1.6. TO WRITE MATLAB
PROGRAMS
MATLAB programs can be written straight to command line (1),
or in m-files. M-files are created by (2), or writing edit
functionName on command line (1). Created files are stored as filename
to current directory, which you can change in (3). You can, for example in case
of a shared computer in laboratory exercises, create a temp directory
under work for keeping your files organized.


FUNCTIONS AND SCRIPTS.
Script is simple M-file that executes all lines as
they were written in the command line. It has no «headers» or
anything, just plain program lines. Scripts see all variables created in
Command line (i.e. workspace) and vice versa.
Functions are «advanced scripts», that take can take
parameters and can produce outputs. Examples of both a script and a function
are given bellow:


To use a script write scriptName on command line.
To use a function, write [output1,outpu2,...] =
functionName(param1, param2) on command line.
In case of single output, drop the []'s. MATLAB has
numerous functions to help your work. You can find out how to use a function by
typing help functionName on command line.
3.1.7. TO END A
PROGRAM.
After writing a program; you have to end it or to finish it in
other to run the writing program. To do this, you type «end» at the
final line of your program.
3.1.8. ACCESS TO
IMPLEMENTATION DETAILS
MATLAB provides many functions for image processing and other
tasks. Most of these functions are written in the MATLAB language and are
publicly readable as plain text files. Thus the implementation details of these
functions are accessible and open to scrutiny. The defense can examine the
processing used in complete detail, and any challenges raised can be responded
to in an informed way by the prosecution. This makes MATLAB very different from
applications, such as Photoshop.
It should be noted that some MATLAB functions couldn't be
viewed. These are generally lower level functions that are computationally
expensive and are hence provided as 'builtin' functions running as native code.
These functions are heavily used and tested and can be relied on with
considerable confidence.
3.1.9. FUNDAMENTALS ON
MATLAB.
A digital image is composed of pixels, which can be
thought of as small dots on the screen. A digital image is an instruction of
how to colour each pixel. We will see in detail later on how this is done in
practice. A typical size of an image is 512-by-512 pixels. Later on in the
course you will see that it is convenient to let the dimensions of the image to
be a power of 2. For example, 29=512. In the general case we say
that an image is of size m-by-n if it is composed of
m pixels in the vertical direction and n pixels in the
horizontal direction.
Let us say that we have an image on the format 512-by-1024
pixels. This means that the data for the image must contain information about
524288 pixels, which requires a lot of memory! Hence, compressing images is
essential for efficient image processing.
APPLICATION OF MATLAB.
The matlab has more application:
Mathematical operation
v Vectors
v Matrices and Matrix operations
v Solving systems of linear equations
v Plotting
v Curve fitting, Interpolation
v MATLAB commands
v Preparing data files and M files
THE USE OF MATLAB.
MATLAB may not be as user friendly as an application like
Photoshop, however, being a general purpose programming language it provides
many important advantages for forensic image processing. It ensures the image
processing steps used are completely documented, and hence can be replicated.
In general, the source code for all image processing functions are accessible
for scrutiny and test. It allows one to ensure numerical precision is
maintained all the way through the enhancement process.
Image processing algorithms available under MATLAB are likely
to be more advanced than those available from other image processing
applications.
|