0% found this document useful (0 votes)
60 views

Chapter-1: The "Best" Biometric Characteristic

matlab

Uploaded by

Ankur Srivastava
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Chapter-1: The "Best" Biometric Characteristic

matlab

Uploaded by

Ankur Srivastava
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 31

CHAPTER- 1

INTRODUCTION

1.1 Biometric Authentication Systems


“Biometric technologies” are automated methods of verifying or recognizing the identity of a living
person based on a physiological or behavioral characteristic”.

There are two key words in this definition: “automated” and “person”. The word “automated”
differentiates biometrics from the larger field of human identification science. Biometric authentication
techniques are done completely by machine, generally (but not always) a digital computer. Forensic
laboratory techniques, such as latent fingerprint, DNA, hair and fiber analysis, are not considered part of
this field. Although automated identification techniques can be used on animals, fruits and vegetables
manufactured goods and the deceased, the subjects of biometric authentication are living humans. For this
reason, the field should perhaps be more accurately called “anthropometric authentication”. The second
key word is “person”. Statistical techniques, particularly using fingerprint patterns, have been used to
differentiate or connect groups of people or to probabilistically link persons to groups, but biometrics is
interested only in recognizing people as individuals. All of the measures used contain both physiological
and behavioral components, both of which can vary widely or be quite similar across a population of
individuals. No technology is purely one or the other, although some measures seem to be more
behaviorally influenced and some more physiologically influenced. The behavioral component of all
biometric measures introduces a “human factors” or “psychological” aspect to biometric authentication as
well. In practice, we often abbreviate the term “biometric authentication” as “biometrics”, although the
latter term has been historically used to mean the branch of biology that deals with its data statistically
and by quantitative analysis So “biometrics”, in this context, is the use of computers to recognize people,
despite all of the across-individual similarities and within-individual variations. Determining “true”
identity is beyond the scope of any biometric technology. Rather, biometric technology can only link a
person to a biometric pattern and any identity data (common name) and personal attributes (age, gender,
profession, residence, nationality) presented at the time of enrollment in the system. Biometric systems
inherently require no identity data, thus allowing anonymous recognition. Ultimately, the performance of
a biometric authentication system, and its suitability for any particular task, will depend upon the
interaction of individuals with the automated mechanism. It is this interaction of technology with human
physiology and psychology that makes “biometrics” such a fascinating subject.

The “Best” Biometric Characteristic

Examples of physiological and behavioral characteristics currently used for automatic identification
include fingerprints, voice, iris, retina, hand, face, handwriting, keystroke, and finger shape. But this is
only a partial list as new measures (such as gait, ear shape, head resonance, optical skin reflectance and
body odor) are being developed all of the time. Because of the broad range of characteristics used, the
imaging requirements for the technology vary greatly. Systems might measure a single one-dimensional
signal (voice); several simultaneous one-dimensional signals (handwriting); a single two-dimensional
image (fingerprint); multiple two dimensional measures (hand geometry); a time series of two-
dimensional images (face and iris); or a three-dimensional image (some facial recognition systems).
Which biometric characteristic is best? The ideal biometric characteristic has five qualities: robustness,
distinctiveness, availability, accessibility and acceptability. By “robust”, we mean unchanging on an
individual over time. By “distinctive”, we mean showing great variation over the population. By
“available”, we mean that the entire population should ideally have this measure in multiples. By
“accessible”, we mean easy to image using electronic sensors. By “acceptable”, we mean that people do
not object to having this measurement taken from them.

The Applications

The operational goals of biometric applications are just as variable as the technologies: some systems
search for known individuals; some search for unknown individuals; some verify a claimed identity; some
verify an unclaimed identity; and some verify that the individual has no identity in the system at all. Some
systems search one or multiple submitted samples against a large database of millions of previously
stored “templates” – the biometric data given at the time of enrollment. Some systems search one or
multiple samples against a database of a few “models” – mathematical representations of the signal
generation process created at the time of enrollment. Some systems compare submitted samples against
models of both the claimed identity and impostor identities. Some systems search one or multiple samples
against only one “template” or “model”.

Figure 1.1(i) - Generic Biometric Authentication System


A System Model

Although these devices rely on widely different technologies, much can be said about them in general.
Figure 1.1 shows a generic biometric authentication system divided into five subsystems: data collection,
transmission, signal processing, decision and data storage. We will consider these subsystems one at a
time.

Data Collection

Biometric systems begin with the measurement of a behavioral/physiological characteristic. Key to all
systems is the underlying assumption that the measured biometric characteristic is both distinctive
between individuals and repeatable over time for the same individual. The problems in measuring and
controlling these variations begin in the data collection subsystem.

Transmission

Some, but not all, biometric systems collect data at one location but store and/or process it at another.
Such systems require data transmission. If a great amount of data is involved, compression may be
required before transmission or storage to conserve bandwidth and storage space. Figure 1.1 shows
compression and transmission occurring before the signal processing and image storage. In such cases,
the transmitted or stored compressed data must be expanded before further use. The process of
compression and expansion generally causes quality loss in the restored signal, with loss increasing with
increasing compression ratio. The compression technique used will depend upon the biometric signal. An
interesting area of research is in finding, for a given biometric technique, compression methods with
minimum impact on the signal-processing subsystem.

Signal Processing

Having acquired and possibly transmitted a biometric characteristic, we must prepare it for matching with
other like measures. Figure 1.1 divides the signal-processing subsystem into four tasks: segmentation,
feature extraction, quality control, and pattern matching. Segmentation is the process of finding the
biometric pattern within the transmitted signal. For example, a facial recognition system must first find
the boundaries of the face or faces in the transmitted image. Once the raw biometric pattern of interest has
been found and extracted from larger signal, the pattern is sent to the feature extraction process. In
general, feature extraction is a form of non-reversible compression, meaning that the original biometric
image cannot be reconstructed from the extracted features after feature extraction, or maybe even before,
we will want to check to see if the signal received from the data collection subsystem is of good quality.
If the features “don’t make sense” or are insufficient in some way we can conclude quickly that the
received signal was defective and request a new sample from the data collection subsystem while the user
is still at the sensor. The development of this “quality control” process has greatly improved the
performance of biometric systems in the last few short years.”, now of very small size compared to the
original signal, will be sent to the pattern matching process for comparison with one or more previously
identified and stored feature templates or models. The purpose of the pattern matching process is to
compare a presented feature sample to the stored data, and to send to the decision subsystem quantitative
Measure of the comparison.

Storage

The remaining subsystem to be considered is that of storage. There will be one or more forms of storage
used, depending upon the biometric system. Templates or models from enrolled users will be stored in a
database for comparison by the pattern matcher to incoming feature samples. For systems only
performing “one-to-one” matching, the database may be distributed on smart cards, optically read cards or
magnetic stripe cards carried by each enrolled user. Depending upon system policy, no central database
need exist, although in this application a centralized database can be used to detect counterfeit cards or to
reissue lost cards without re-collecting the biometric pattern.

Decision

The decision subsystem implements system policy by directing the databases search, determines
“matches” or “non-matches” based on the distance or similarity measures received from the pattern
matcher, and ultimately makes an “accept/reject” decision based on the system policy. Such a decision
policy could be to reject the identity claim (either positive or negative) of any user whose pattern could
not be acquired. For an acquired pattern, the policy might declare a match for any distance lower than a
fixed threshold and “accept” a user identity claim on the basis of this single match, or the policy could be
to declare a match for any distance lower than a user-dependent, time-variant, or environmentally linked
threshold and require matches from multiple measures for an “accept” decision.

1.2 Face Recognition


Face recognition falls into the broadly defined area of biometrics, which is concerned with the verification
and recognition of a person’s identity by means of unique appearance or behavioral characteristics.
Appearance characteristics include hand, fingerprint, eye, iris, retina and face, while behavioral
characteristics include signature, voice, keystroke and grip .Automated fingerprint recognition, speaker
and speech recognition, and iris and retina recognition are all examples of “active” biometric tasks. Face
recognition, however, is usually “passive”, as it does not require people’s cooperation to look into an iris
scanner, to place their hands on a fingerprint reader, or to speak to a close-by microphone. The
unobtrusive nature of face recognition makes it more suitable for wide range surveillance and security
applications. In particular, an automated face recognition system is capable of capturing face images from
a distance using a video camera, and the face recognition algorithms can process the data captured: detect,
track and finally recognize people sought, such as terrorists or drug traffickers. Face recognition involves
computer recognition of personal identity based on geometric or statistical features derived from face
images Even though humans can detect and identify faces in a scene with little or no effort, building an
automated system that accomplishes such objectives is very challenging. The challenges are even more
profound when one considers the large variations in the visual stimulus due to illumination conditions,
viewing directions or poses, facial expression, aging, and disguises such as facial hair, glasses or
cosmetics. The enormity of the problem has involved hundreds of scientists in interdisciplinary research,
but the ultimate solution remains elusive. Face recognition research provides cutting edge technologies in
commercial, law enforcement and military applications. An automated vision system that performs the
functions of face detection, verification and recognition will find countless unobtrusive applications, such
as airport security and access control, building (i.e. embassies) surveillance and monitoring, human–
computer intelligent interaction and perceptual interfaces, and smart environments at home, in the office,
and in cars

Background

An automated face recognition system includes several related face processing tasks, such as detection of
a pattern as a face, face tracking in a video sequence, face verification, and face recognition. Face
detection generally learns the statistical models of the face and non-face images, and then applies a two-
class classification rule to discriminate between face and non-face patterns. Face tracking predicts the
motion of faces in a sequence of images based on their previous trajectories and estimates the current and
future positions of those faces. While face verification is mainly concerned with authenticating a claimed
identity posed by a person, such as “Is she the person who she claims to be?” face recognition focuses on
recognizing the identity of a person from a database of known individuals. Shows a block diagram of the
overall face recognition system.

Figure 1.2 (i) – Block diagram of Face Recognition System

When an input image is presented to the face recognition system, the system first performs face detection
and facial landmark detection, such as the detection of the centers of the eyes. The system then
implements the normalization and cropping procedures, which perform the following three tasks:

(1) Spatial normalization, which aligns the centers of the eyes to predefined locations and fixes the
number of pixels between the eyes (intraocular distance) via rotation and scaling transformations;
(2) Facial region extraction, which crops the facial region that contains only the face, so that the
performance of face recognition is not affected by the factors not related to the face itself, such as hair
styles;
(3) Intensity normalization, which converts the facial region to a vector by concatenating its rows (or
columns), and then normalizes the pixels in the vector to zero mean and unit variance. Finally, the system
extracts features with high discriminating power for face recognition.

Performance evaluation is an important factor for a face recognition system. The strength and weakness
of an automated face recognition system are evaluated using standard databases and objective
performance statistics.

1.3 Face detection


Face detection is the first stage of an automated face recognition system, since a face has to be located in
the overall image before it is recognized. Earlier efforts had been focused on correlation or template
matching, matched filtering, sub-space methods, deformable templates etc. Recent approaches emphasize
data-driven learning-based techniques, such as statistical modeling methods, neural network based
learning methods statistical learning theory and Support Vector Machine (SVM) based methods, Markov
random field based methods and color-based face detection.

Statistical methods usually start with the estimation of the distributions of the face and non-face patterns,
and then apply a pattern classifier or a face detector to search over a range of scales and locations for
possible human faces. Neural network-based methods, however, learn to discriminate the implicit
distributions of the face and non-face patterns by means of training samples and the network structure,
without involving an explicit estimation procedure.
Rowley et al. developed a neural network-based upright, frontal face detection system, which applies a
retinally connected neural network to examine small windows of an image and decide whether each
window contains a face. The face detector, which was trained using a large number of face and non-face
examples, contains a set of neural network-based filters and an arbitrator which merges detections from
individual filters and eliminates overlapping detections. In order to detect faces at any degree of rotation
in the image plane, the system was extended to incorporate a separate router network, which determines
the orientation of the face pattern. The pattern is then derotated back to the upright position, which can be
processed by the early developed system.

Hsu et al. presented a color-based face detection method under variable illumination and complex
background. First, the method applies a lighting compensation technique and a nonlinear color
transformation to detect skin regions in a color image. Then it generates face candidates based on the
spatial arrangement of the skin patches. Finally, the method constructs eye, mouth and boundary maps to
verify those candidates. Experiments show that the method is capable of detecting faces over a wide range
of facial variations in color, position, scale, orientation, pose and expression

1.4 Face recognition representation and classification

Robust face recognition schemes require both low-dimensional feature representation for data
compression purposes and enhanced discrimination abilities for subsequent image classification.
The representation methods usually start with a dimensionality reduction procedure, since the high
dimensionality of the original space makes the statistical estimation very difficult, if not impossible,
due to the fact that the high-dimensional space is mostly empty. The discrimination methods often
try to achieve high separability between different patterns. Table 1.4 shows some popular
representation and classification techniques and some methods that apply these techniques for face
recognition

TECHNIQUES FACE RECOGNITION METHOD

REPRESENTATION METHOD PCA Eigen Faces, PRM


Shape & Texture EFC
Gabor Wavelets GFC, IGF

RECOGNITION METHOD Bayes/Map PRM


FLD/LDA Fisher Faces, EFM
ICA EICA
Graph Matching EBG(Elastic Bunch Graph)

Table 1.4 (i)

Some Representation Techniques and Their Applications to Face Recognition

Principal Component Analysis is commonly used for deriving low-dimensional representations of input
images. Specifically, PCA derives an orthogonal projection basis that directly leads to dimensionality
reduction and possibly to feature selection. Applying PCA technique to face recognition, Turk and
Pentland developed the well-known “Eigen face” method, where the Eigen faces correspond to the
eigenvectors associated with the largest eigenvalues of the face covariance matrix. The Eigen faces thus
define a feature space, or “face space”, which drastically reduces the dimensionality of the original space,
and face recognition is then carried out in the reduced space.

The Gabor wavelets, whose kernels are similar to the 2D receptive field profiles of the mammalian
cortical simple cells, exhibit desirable characteristics of spatial locality and orientation selectivity. The
biological relevance and computational properties of Gabor wavelets for image analysis have been
described. Lades et al. applied the Gabor wavelets for face recognition using dynamic link architecture
(DLA). This starts by computing the Gabor jets, and then performs a flexible template comparison
between the resulting image decompositions using graph matching. Based on the 2D Gabor wavelet
representation and labeled elastic graph matching, Lyons et al. proposed an algorithm for two-class
categorization of gender, race and facial expression. The algorithm includes two steps: registration of a
grid with the face using either labeled elastic graph matching or manual annotation of 34 points on every
face image, and categorization based on the features extracted at grid points using Linear Discriminant
Analysis (LDA). Donato et al. recently compared a method based on Gabor representation with other
techniques and found that the former gave better performance. Liu and Wechsler presented a Gabor–
Fisher Classifier (GFC) method for face recognition. The GFC method, which is robust to illumination
and facial expression variability, applies the enhanced Fisher linear discriminant model or EFM to an
augmented Gabor feature vector derived from the Gabor wavelet transformation of face images. To
encompass all the features produced by the different Gabor kernels one concatenates the resulting Gabor
wavelet features to derive an augmented Gabor feature vector. The dimensionality of the Gabor vector
space is then reduced under the eigenvalue selectivity constraint of the EFM method to derive a low-
dimensional feature representation with enhanced discrimination power. Liu and Wechsler recently
developed an Independent Gabor Features (IGF) method for face recognition The IGF method derives the
independent Gabor features, whose independence property facilitates the application of the PRM method
for classification.

This chapter has surveyed recent research in biometric technology, its application in face detection and
recognition, discussed performance of the current face recognition systems, and presented promising
research directions. In particular, face detection methods reviewed include statistical, neural network-
based and color based approaches. Face recognition methods surveyed include PCA-based approaches,
shape and texture-based approaches, Gabor wavelet-based approaches, these methods provide new
research directions for potential solutions to facial recognition under conditions of pose and illumination
variation, which recent vendor tests show are challenging issues for face recognition.
CHAPTER 2

MATLAB – THE LANGUAGE OF TECHNICAL COMPUTING

MATLAB is a high-performance language for technical computing. It integrates computation,


visualization, and programming in an easy-to-use environment where problems and solutions are
expressed in familiar mathematical notation. Typical uses include:

•Math and computation


•Algorithm development
•Modeling, simulation, and prototyping
•Data analysis, exploration, and visualization
•Scientific and engineering graphics
•Application development, including graphical user interface building

Figure 2 (i) – MATLAB

2.1 Overview of the MATLAB Environment

MATLAB is a high-level technical computing language and interactive environment for algorithm
development, data visualization, data analysis, and numeric computation. Using the MATLAB product,
we can solve technical computing problems faster than with traditional programming languages, such as
C, C++, and FORTRAN. We can use MATLAB in a wide range of applications, including signal and
image processing, communications, control design, test and measurement, financial modeling and
analysis, and computational biology. Add-on toolboxes (collections of special-purpose MATLAB
functions, available separately) extend the MATLAB environment to solve particular classes of problems
in these application areas. MATLAB provides a number of features for documenting and sharing your
work. We can integrate your MATLAB code with other languages and applications, and distribute your
MATLAB algorithms and applications .Features includes:

• High-level language for technical computing.


• Development environment for managing code, files, and data
• Interactive tools for iterative exploration, design, and problem solving
• Mathematical functions for linear algebra, statistics, Fourier analysis, filtering, optimization, and
Numerical Integration
• 2-D and 3-D graphics functions for visualizing data
• Tools for building custom graphical user interfaces
• Functions for integrating MATLAB based algorithms with external applications and languages, such as
C, C++, FORTRAN, Java™, COM, and Microsoft® Excel®

MATLAB is an interactive system whose basic data element is an array that does not require
dimensioning. This allows you to solve many technical computing problems, especially those with matrix
and vector formulations, in a fraction of the time it would take to write a program in a scalar non
interactive language such as C or FORTRAN.

The name MATLAB stands for matrix laboratory. MATLAB was originally written to provide easy
access to matrix software developed by the LINPACK and EISPACK projects. Today, MATLAB uses
software developed by the LAPACK and ARPACK projects, which together represent the state-of-the-art
in software for matrix computation.

MATLAB has evolved over a period of years with input from many users. In university environments, it
is the standard instructional tool for introductory and advanced courses in mathematics, engineering, and
science. In industry, MATLAB is the tool of choice for high-productivity research, development, and
analysis.

2.1.1 Simulink

Simulink, a companion program to MATLAB, is an interactive system for simulating nonlinear dynamic
systems. It is a graphical mouse-driven program that allows you to model a system by drawing a block
diagram on the screen and manipulating it dynamically. It can work with linear, nonlinear, continuous-
time, discrete-time, multirate, and hybrid systems.

Blocksets are add-ons to Simulink that provide additional libraries of blocks for specialized applications
like communications, signal processing, and power systems.

Real-Time Workshop® is a program that allows you to generate C code from your block diagrams and to
run it on a variety of real-time systems.

Stateflow

Stateflow is an interactive design tool for modeling and simulating complex reactive systems. Tightly
integrated with Simulink and MATLAB, Stateflow provides Simulink users with an elegant solution for
designing embedded systems by giving them an efficient way to incorporate complex control and
supervisory logic within their Simulink models.
With Stateflow, you can quickly develop graphical models of event-driven systems using finite state
machine theory, statechart formalisms, and flow diagram notation. Together, Stateflow and Simulink
serve as an executable specification and virtual prototype of your system design.
2.2 The MATLAB System

The MATLAB system consists of five main parts:

Development Environment This is the set of tools and facilities that help you use MATLAB functions
and files. Many of these tools are graphical user interfaces. It includes the MATLAB desktop and
Command Window, a command history, and browsers for viewing help, the workspace, files, and the
search path.

The MATLAB Mathematical Function Library. This is a vast collection of computational algorithms
ranging from elementary functions like sum, sine, cosine, and complex arithmetic, to more sophisticated
functions like matrix inverse, matrix eigenvalues, Bessel functions, and fast Fourier transforms.

The MATLAB language. This is a high-level matrix/array language with control flow statements,
functions, data structures, input/output, and object-oriented programming features. It allows both
“programming in the small” to rapidly create quick and dirty throw-away programs, and “programming in
the large” to create complete large and complex application programs.

Handle Graphics®. This is the MATLAB graphics system. It includes high-level commands for two-
dimensional and three-dimensional data visualization, image processing, animation, and presentation
graphics. It also includes low-level commands that allow you to fully customize the appearance of
graphics as well as to build complete graphical user interfaces on your MATLAB applications.

The MATLAB Application Program Interface (API). This is a library that allows you to write C and
FORTRAN programs that interact with MATLAB. It include facilities for calling routines from
MATLAB (dynamic linking), calling MATLAB as a computational engine, and for reading and writing
MAT-files.

2.2.1 Development Environment

MATLAB Desktop

When we start MATLAB, the MATLAB desktop appears, containing tools (graphical user interfaces) for
managing files, variables, and applications associated with MATLAB.

Desktop tools

This section provides an introduction to MATLAB’s desktop tools. You can also use MATLAB functions
to perform most of the features found in the desktop tools. The tools are:

• Command Window
• Command History
• Launch Pad
• Help Browser
• Current Directory Browser
• Workspace Browser
• Array Editor
• Editor/Debugger
Figure 2.2 (i) – MATLAB Dextop

Command Window

Use the Command Window to enter variables and run functions and M-files.

Figure 2.2 (ii) – MATLAB Command Window


Command History

Lines you enter in the Command Window are logged in the Command History window. In the
Command History, we can view previously used functions, and copy and execute selected lines.

Figure 2.2 (iii) – MATLAB Command History

Launch Pad

Figure 2.2 (iv) – MATLAB Launch Pad


Help Browser

Use the Help browser to search and view documentation for all Math Works products. The Help browser
is a Web browser integrated into the MATLAB desktop that displays HTML documents. To open the
Help browser, click the help button in the toolbar, or type help browser in the Command Window

Figure 2.2 (v) – MATLAB Help Browser

The Help browser consists of two panes, the Help Navigator, which you use to find information, and the
display pane, where you view the information.

Help Navigator

Use to Help Navigator to find information. It includes:

•Product filter – Set the filter to show documentation only for the products you specify.
•Contents tab – View the titles and tables of contents of documentation for your products.
•Index tab – Find specific index entries (selected keywords) in the Math Works documentation for your
Products.
•Search tab – Look for a specific phrase in the documentation. To get help for a specific function, set the
Search type to Function Name.
•Favorites tab – View a list of documents you previously designated as favorites.
Display Pane

After finding documentation using the Help Navigator, view it in the display pane. While viewing the
documentation, we can:

•Browse to other pages – Use the arrows at the tops and bottoms of the pages, or use the back and
forward buttons in the toolbar.
•Bookmark pages – Click the Add to Favorites button in the toolbar.
•Print pages – Click the print button in the toolbar.
•Find a term in the page – Type a term in the Find in page field in the toolbar and click Go.

Current Directory browser

MATLAB file operations use the current directory and the search path as reference points. Any file you want to run
must either be in the current directory or on the search path.

A quick way to view or change the current directory is by using the Current Directory field in the desktop toolbar as
shown below.

To search for, view, open, and make changes to MATLAB-related directories and files, use the MATLAB Current
Directory browser. Alternatively, you can use the functions dir, cd, and delete.

Figure 2.2 (vi) – MATLAB Current Directory Browser


Workspace Browser
The MATLAB workspace consists of the set of variables (named arrays) built up during a MATLAB session and
stored in memory. Our add variables to the workspace by using functions, running M-files, and loading saved
workspaces .To view the workspace and information about each variable, use the Workspace browser, or use the
functions who and whos.

Figure 2.2 (vii) – MATLAB Workspace Browser

Array Editor

Double-click on a variable in the Workspace browser to see it in the Array Editor. Use the Array Editor to
view and edit a visual representation of one- or two-dimensional numeric arrays, strings, and cell arrays
of strings that are in the workspace.

Figure 2.2 (viii) – MATLAB Array Editor

rray Editor
Editor Debugger

Use the Editor/Debugger to create and debug M-files, which are programs you write to run MATLAB
functions. The Editor/Debugger provides a graphical user interface for basic text editing, as well as for M-
file debugging.

Figure 2.2 (ix) – MATLAB Editor Debugger

2.2.2 Other Development Environment Features


Additional development environment features are:

•Importing and Exporting Data – Techniques for bringing data created by other applications into the
MATLAB workspace, including the Import Wizard, and packaging MATLAB workspace variables for
use by other applications.
•Improving M-File Performance – The Profiler is a tool that measures where an M-file is spending its
time. Use it to help you make speed improvements.
•Interfacing with Source Control Systems – Access your source control system from within MATLAB,
Simulink, and Stateflow.
•Using Notebook – Access MATLAB’s numeric computation and visualization software from within a
word processing environment (Microsoft Word).
2.2.3 MATLAB Toolbox

S.no TOOLBOX S.no TOOLBOX

1 Aerospace Toolbox 23 Model Predictive Control Toolbox


2 Bioinformatics Toolbox 24 Model Based Calibration Toolbox
3 Communication Toolbox 25 Neural Network Toolbox
4 Computer Vision System Toolbox 26 OPC Toolbox
5 Control System Toolbox 27 Optimization Toolbox
6 Curve Fitting Toolbox 28 Parallel Computing Toolbox
7 Data Acquisition Toolbox 29 Partial Differentiation Toolbox
8 Database Toolbox 30 RF Toolbox
9 Data feed Toolbox 31 Robust Control Toolbox
10 Ecometrics Toolbox 32 Signal Processing Toolbox
11 Filter Design Toolbox 33 Spline Toolbox
12 Filter Design HDL Coder 34 Statistics Toolbox
13 Financial Toolbox 35 Symbolic Math Toolbox
14 Financial Derivative Toolbox 36 System Identification Toolbox
15 Fixed Income Toolbox 37 Vehicle Network Toolbox
16 Fixed Point Toolbox 38 Wavelet Toolbox
17 Fuzzy Logic Toolbox
18 Genetic Algorithm & Direct Search Toolbox
19 Image Acquisition Toolbox
20 Image Processing Toolbox
21 Instrument Control Toolbox
22 Mapping Toolbox

Table 2.2 (i) – MATLAB Toolbox


CHAPTER 3

IMAGE PROCESSING TOOLBOX

3.1 Introduction

The Image Processing Toolbox software is a collection of functions that extend the capability of the
MATLAB numeric computing environment. The toolbox supports a wide range of image processing
operations, including

 Spatial image transformations


 Morphological operations
 Neighborhood and block operations
 Linear filtering and filter design
 Transforms
 Image analysis and enhancement
 Image registration
 Deblurring
 Region of interest operations

Many of the toolbox functions are MATLAB M-files, a series of MATLAB statements that implement
specialized image processing algorithms. We can view the MATLAB code for these functions using the
statement

type function_name

we can extend the capabilities of the toolbox by writing your own M-files, or by using the toolbox in
combination with other toolboxes, such as the Signal Processing Toolbox™ software and the Wavelet
Toolbox™ software.

3.2 Images
The first step in MATLAB image processing is to understand that a digital image is composed of a two or
three dimensional matrix of pixels. Individual pixels contain a number or numbers representing what
grayscale or color value is assigned to it. Color pictures generally contain three times as much data as
grayscale pictures, depending on what color representation scheme is used. Therefore, color pictures take
three times as much computational power to process. In this tutorial the method for conversion from color
to grayscale will be demonstrated and all processing will be done on grayscale images. However, in order
to understand how image processing works, we will begin by analyzing simple two dimensional 8-bit
matrices.
3.2.1 Read and Display an Image
First, clear the MATLAB workspace of any variables and close open figure windows.

close all

To read an image, use the imread command. The example reads one of the sample images included with
the toolbox, pout.tif, and stores it in an array named I.

I = imread ('pout.tif');

imread infers from the file that the graphics file format is Tagged Image File Format (TIFF). For the list
of supported graphics file formats

Now display the image. The toolbox includes two image display functions: imshow and imtool. imshow
is the toolbox's fundamental image display function. imtool starts the Image Tool which presents an
integrated environment for displaying images and performing some common image processing tasks. The
Image Tool provides all the image display capabilities of imshow but also provides access to several other
tools for navigating and exploring images, such as scroll bars, the Pixel Region tool, Image Information
tool, and the Contrast Adjustment tool. This example uses imshow.

imshow(I)

Figure 3.2 (i)


3.2.2 Check How the Image Appears in the Workspace
To see how the imread function stores the image data in the workspace, check the Workspace browser in
the MATLAB desktop. The Workspace browser displays information about all the variables you create
during a MATLAB session. The imread function returned the image data in the variable I, which is a 291-
by-240 element array of uint8 data. MATLAB can store images as uint8, uint16, or double arrays. We can
also get information about variables in the workspace by calling the whos command.

whos

MATLAB responds with

Name Size Bytes Class Attributes

I 291x240 69840 uint8

3.2.3 Improve Image Contrast


pout.tif is a somewhat low contrast image. To see the distribution of intensities in pout.tif, you can create
a histogram by calling the imhist function. (Precede the call to imhist with the figure command so that the
histogram does not overwrite the display of the image I in the current figure window.)

figure, imhist(I)

Figure 3.2 (ii)

Notice how the intensity range is rather narrow. It does not cover the potential range of [0, 255], and is
missing the high and low values that would result in good contrast.
The toolbox provides several ways to improve the contrast in an image. One way is to call the histeq
function to spread the intensity values over the full range of the image, a process called histogram
equalization.

I2 = histeq(I);

Display the new equalized image, I2, in a new figure window.

Figure 3.2 (iii)

Call imhist again to create a histogram of the equalized image I2. If we compare the two histograms, the
histogram of I2 is more spread out than the histogram of I1.

figure, imhist(I2)

Figure 3.2 (iv)


The toolbox includes several other functions that perform contrast adjustment, including the imadjust and
adapthisteq functions. In addition, the toolbox includes an interactive tool, called the Adjust Contrast
tool, that we can use to adjust the contrast and brightness of an image displayed in the Image Tool. To use
this tool, call the imcontrast function or access the tool from the

3.2.4 Write the Image to a Disk File


To write the newly adjusted image I2 to a disk file, use the imwrite function. If you include the filename
extension '.png', the imwrite function writes the image to a file in Portable Network Graphics (PNG)
format, but you can specify other formats.

imwrite (I2, 'pout2.png');

3.2.5 Check the Contents of the Newly Written File


To see what imwrite wrote to the disk file, use the imfinfo function.

imfinfo('pout2.png')

The imfinfo function returns information about the image in the file, such as its format, size, width, and
height.

ans =

Filename: 'pout2.png'
FileModDate: '29-Dec-2005 09:34:39'
FileSize: 36938
Format: 'png'
FormatVersion: []
Width: 240
Height: 291
BitDepth: 8
ColorType: 'grayscale'
FormatSignature: [137 80 78 71 13 10 26 10]
Colormap: []
Histogram: []
InterlaceType: 'none'
Transparency: 'none'
SimpleTransparencyData: []
BackgroundColor: []
RenderingIntent: []
Chromaticities: []
Gamma: []
XResolution: []
YResolution: []
ResolutionUnit: []
XOffset: []
YOffset: []
OffsetUnit: []
SignificantBits: []
ImageModTime: '29 Dec 2005 14:34:39 +0000'
Title: []
Author: []
Description: []
Copyright: []
CreationTime: []
Software: []
Disclaimer: []
Warning: []
Source: []
Comment: []
OtherText: []

3.3 Analyzing Images


Using an image of rice grains, this example illustrates how you can enhance an image to correct for non-
uniform illumination, and then use the enhanced image to identify individual grains. This enables you to
learn about the characteristics of the grains and easily compute statistics for all the grains in the image.

3.3.1 Read Image


Read and display the grayscale image rice.png.

I = imread('rice.png');
imshow(I)

Figure 3.3 (i)


3.3.2 Use Morphological Opening to Estimate the Background
In the sample image, the background illumination is brighter in the center of the image than at the bottom.
In this step, the example uses a morphological opening operation to estimate the background illumination.
Morphological opening is an erosion followed by a dilation, using the same structuring element for both
operations. The opening operation has the effect of removing objects that cannot completely contain the
structuring element.

background = imopen(I,strel('disk',15));

The example calls the imopen function to perform the morphological opening operation. Note how the
example calls the strel function to create a disk-shaped structuring element with a radius of 15. To remove
the rice grains from the image, the structuring element must be sized so that it cannot fit entirely inside a
single grain of rice.

3.3.3. View the Background Approximation as a Surface


Use the surf command to create a surface display of the background (the background approximation
created in Step 2). The surf command creates colored parametric surfaces that enable you to view
mathematical functions over a rectangular region. However, the surf function requires data of class
double, so you first need to convert background using the double command:

figure, surf(double(background(1:8:end,1:8:end))),zlim([0 255]);


set(gca,'ydir','reverse');

The example uses MATLAB indexing syntax to view only 1 out of 8 pixels in each direction; otherwise,
the surface plot would be too dense. The example also sets the scale of the plot to better match the range
of the uint8 data and reverses the y-axis of the display to provide a better view of the data. (The pixels at
the bottom of the image appear at the front of the surface plot.)

In the surface display, [0, 0] represents the origin, or upper-left corner of the image. The highest part of
the curve indicates that the highest pixel values of background (and consequently rice.png) occur near the
middle rows of the image. The lowest pixel values occur at the bottom of the image and are represented in
the surface plot by the lowest part of the curve.

Figure 3.3 (ii)


3.3.4 Subtract the Background Image from the Original Image
To create a more uniform background, subtract the background image, background, from the original
image, I, and then view the image:

I2 = I - background;
imshow(I2)

Figure 3.3 (iii)

3.3.5 Increase the Image Contrast


After subtraction, the image has a uniform background but is now a bit too dark. Use imadjust to adjust
the contrast of the image. imadjust increases the contrast of the image by saturating 1% of the data at both
low and high intensities of I2 and by stretching the intensity values to fill the uint8 dynamic range. See
the imadjust reference page for more information.

The following example adjusts the contrast in the image created in the previous step and displays it:

I3 = imadjust(I2);
imshow(I3);

Figure 3.3 (iv)


3.3.6 Threshold the Image
Create a binary version of the image so you can use toolbox functions to count the number of rice grains.
Use the im2bw function to convert the grayscale image into a binary image by using thresholding. The
function graythresh automatically computes an appropriate threshold to use to convert the grayscale
image to binary. Remove background noise with bwareaopen:

level = graythresh(I3);
bw = im2bw(I3,level);
bw = bwareaopen(bw, 50);
imshow(bw)

Figure 3.3 (v)

3.3.7 Identify Objects in the Image


The function bwconncomp finds all the connected components (objects) in the binary image. The
accuracy of your results depends on the size of the objects, the connectivity parameter (4, 8, or arbitrary),
and whether or not any objects are touching (in which case they could be labeled as one object). Some of
the rice grains in bw are touching.

cc = bwconncomp(bw, 4);
cc.NumObjectscc =
Connectivity: 4
ImageSize: [256 256]
NumObjects: 95
PixelIdxList: {1x95 cell}

ans =

95

3.3.8 Examine One Object


Each distinct object is labeled with the same integer value. Show the grain that is the 50th connected
component:

grain = false(size(bw));
grain(cc.PixelIdxList{50}) = true;
imshow(grain);

Figure 3.3 (vi)

3.3.9 View All Objects


One way to visualize connected components is to create a label matrix, and then display it as a
pseudo-color indexed image. Use labelmatrix to create a label matrix from the output of
bwconncomp. Note that labelmatrix stores the label matrix in the smallest numeric class necessary
for the number of objects. Since bw contains only 95 objects, the label matrix can be stored as
uint8:

labeled = labelmatrix(cc);
whos labeled
Name Size Bytes Class Attributes

labeled 256x256 65536 uint8

In the pseudo-color image, the label identifying each object in the label matrix maps to a different color in
the associated colormap matrix. Use label2rgb to choose the colormap, the background color, and how
objects in the label matrix map to colors in the colormap:

RGB_label = label2rgb(labeled, @spring, 'c', 'shuffle');


imshow(RGB_label)

Figure 3.3 (vii)- Label Matrix Displayed as Pseudo color Image

3.3.10 Compute Area of Each Object


Each rice grain is one connected component in the cc structure. Use regionprops on cc to compute the
area.

graindata = regionprops(cc, 'basic')

MATLAB responds with

graindata =

95x1 struct array with fields:


Area
Centroid
BoundingBox

To find the area of the 50th component, use dot notation to access the Area field in the 50th element of
graindata structure array:

graindata(50).Area
ans =

194

3.3.11 Compute Area-based Statistics


Create a new vector allgrains to hold the area measurement for each grain:

grain_areas = [graindata.Area];

Find the grain with the smallest area:

[min_area, idx] = min(grain_areas)


grain = false(size(bw));
grain(cc.PixelIdxList{idx}) = true;
imshow(grain);
min_area =

61

idx =

16
Figure 3.3 (viii)-Smallest Grain

3.3.12 Create Histogram of the Area


Use hist to create a histogram of the rice grain area:

nbins = 20;
figure, hist(grain_areas, nbins)
title('Histogram of Rice Grain Area');

Figure 3.3 (ix)


CHAPTER 4

NEURAL NETWORK TOOLBOX

You might also like