SlideShare a Scribd company logo
1 of 355
Download to read offline
Fundamentals of Digital
Image Processing
A Practical Approach
with Examples in Matlab
Chris Solomon
School of Physical Sciences, University of Kent, Canterbury, UK
Toby Breckon
School of Engineering, Cranfield University, Bedfordshire, UK
Fundamentals of Digital
Image Processing
Fundamentals of Digital
Image Processing
A Practical Approach
with Examples in Matlab
Chris Solomon
School of Physical Sciences, University of Kent, Canterbury, UK
Toby Breckon
School of Engineering, Cranfield University, Bedfordshire, UK
This edition first published 2011, Ó 2011 by John Wiley & Sons, Ltd
Wiley Blackwell is an imprint of John Wiley & Sons, formed by the merger of Wiley’s global Scientific,
Technical and Medical business with Blackwell Publishing.
Registered office: John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester,
West Sussex, PO19 8SQ, UK
Editorial Offices:
9600 Garsington Road, Oxford, OX4 2DQ, UK
111 River Street, Hoboken, NJ 07030 5774, USA
For details of our global editorial offices, for customer services and for information about how to
apply for permission to reuse the copyright material in this book please see our website at
www.wiley.com/wiley blackwell
The right of the author to be identified as the author of this work has been asserted in accordance with
the Copyright, Designs and Patents Act 1988.
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or
transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise,
except as permitted by the UK Copyright, Designs and Patents Act 1988, without the prior permission
of the publisher.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in
print may not be available in electronic books.
Designations used by companies to distinguish their products are often claimed as trademarks. All brand
names and product names used in this book are trade names, service marks, trademarks or registered
trademarks of their respective owners. The publisher is not associated with any product or vendor mentioned
in this book. This publication is designed to provide accurate and authoritative information in regard to
the subject matter covered. It is sold on the understanding that the publisher is not engaged in rendering
professional services. If professional advice or other expert assistance is required, the services of a
competent professional should be sought.
MATLABÒ
is a trademark of TheMathWorks,Inc. and is used with permission.The MathWorks does notwarrant
the accuracy of the text or exercises in this book. This book’s use or discussion of MATLABÒ
software or related
products does not constitute endorsement or sponsorship by The MathWorks of a particular pedagogical
approach or particular use of the MATLABÒ
software.
Library of Congress Cataloguing in Publication Data
Solomon, Chris and Breckon, Toby
Fundamentals of digital image processing : a practical approach with examples in Matlab / Chris Solomon and
Toby Breckon
p. cm.
Includes index.
Summary:“Fundamentals of DigitalImageProcessingis an introductory textonthescience ofimage processing
and employs the Matlab programming language to illustrate some of the elementary, key concepts in modern
image processing and pattern recognition drawing on specific examples from within science, medicine and
electronics” Provided by publisher.
ISBN 978 0 470 84472 4 (hardback) ISBN 978 0 470 84473 1 (pbk.)
1. Image processing Digital techniques. 2. Matlab. I. Breckon, Toby. II. Title.
TA1637.S65154 2010
621.36’7 dc22
2010025730
This book is published in the following electronic formats: eBook 9780470689783; Wiley Online Library
9780470689776
A catalogue record for this book is available from the British Library.
Set in 10/12.5 pt Minion by Thomson Digital, Noida, India
1 2011
Contents
Preface xi
Using the book website xv
1 Representation 1
1.1 What is an image? 1
1.1.1 Image layout 1
1.1.2 Image colour 2
1.2 Resolution and quantization 3
1.2.1 Bit-plane splicing 4
1.3 Image formats 5
1.3.1 Image data types 6
1.3.2 Image compression 7
1.4 Colour spaces 9
1.4.1 RGB 10
1.4.1.1 RGB to grey-scale image conversion 11
1.4.2 Perceptual colour space 12
1.5 Images in Matlab 14
1.5.1 Reading, writing and querying images 14
1.5.2 Basic display of images 15
1.5.3 Accessing pixel values 16
1.5.4 Converting image types 17
Exercises 18
2 Formation 21
2.1 How is an image formed? 21
2.2 The mathematics of image formation 22
2.2.1 Introduction 22
2.2.2 Linear imaging systems 23
2.2.3 Linear superposition integral 24
2.2.4 The Dirac delta or impulse function 25
2.2.5 The point-spread function 28
2.2.6 Linear shift-invariant systems and the convolution
integral 29
2.2.7 Convolution: its importance and meaning 30
2.2.8 Multiple convolution: N imaging elements
in a linear shift-invariant system 34
2.2.9 Digital convolution 34
2.3 The engineering of image formation 37
2.3.1 The camera 38
2.3.2 The digitization process 40
2.3.2.1 Quantization 40
2.3.2.2 Digitization hardware 42
2.3.2.3 Resolution versus performance 43
2.3.3 Noise 44
Exercises 46
3 Pixels 49
3.1 What is a pixel? 49
3.2 Operations upon pixels 50
3.2.1 Arithmetic operations on images 51
3.2.1.1 Image addition and subtraction 51
3.2.1.2 Multiplication and division 53
3.2.2 Logical operations on images 54
3.2.3 Thresholding 55
3.3 Point-based operations on images 57
3.3.1 Logarithmic transform 57
3.3.2 Exponential transform 59
3.3.3 Power-law (gamma) transform 61
3.3.3.1 Application: gamma correction 62
3.4 Pixel distributions: histograms 63
3.4.1 Histograms for threshold selection 65
3.4.2 Adaptive thresholding 66
3.4.3 Contrast stretching 67
3.4.4 Histogram equalization 69
3.4.4.1 Histogram equalization theory 69
3.4.4.2 Histogram equalization theory: discrete case 70
3.4.4.3 Histogram equalization in practice 71
3.4.5 Histogram matching 73
3.4.5.1 Histogram-matching theory 73
3.4.5.2 Histogram-matching theory: discrete case 74
3.4.5.3 Histogram matching in practice 75
3.4.6 Adaptive histogram equalization 76
3.4.7 Histogram operations on colour images 79
Exercises 81
vi CONTENTS
4 Enhancement 85
4.1 Why perform enhancement? 85
4.1.1 Enhancement via image filtering 85
4.2 Pixel neighbourhoods 86
4.3 Filter kernels and the mechanics of linear filtering 87
4.3.1 Nonlinear spatial filtering 90
4.4 Filtering for noise removal 90
4.4.1 Mean filtering 91
4.4.2 Median filtering 92
4.4.3 Rank filtering 94
4.4.4 Gaussian filtering 95
4.5 Filtering for edge detection 97
4.5.1 Derivative filters for discontinuities 97
4.5.2 First-order edge detection 99
4.5.2.1 Linearly separable filtering 101
4.5.3 Second-order edge detection 102
4.5.3.1 Laplacian edge detection 102
4.5.3.2 Laplacian of Gaussian 103
4.5.3.3 Zero-crossing detector 104
4.6 Edge enhancement 105
4.6.1 Laplacian edge sharpening 105
4.6.2 The unsharp mask filter 107
Exercises 109
5 Fourier transforms and frequency-domain processing 113
5.1 Frequency space: a friendly introduction 113
5.2 Frequency space: the fundamental idea 114
5.2.1 The Fourier series 115
5.3 Calculation of the Fourier spectrum 118
5.4 Complex Fourier series 118
5.5 The 1-D Fourier transform 119
5.6 The inverse Fourier transform and reciprocity 121
5.7 The 2-D Fourier transform 123
5.8 Understanding the Fourier transform: frequency-space filtering 126
5.9 Linear systems and Fourier transforms 129
5.10 The convolution theorem 129
5.11 The optical transfer function 131
5.12 Digital Fourier transforms: the discrete fast Fourier transform 134
5.13 Sampled data: the discrete Fourier transform 135
5.14 The centred discrete Fourier transform 136
6 Image restoration 141
6.1 Imaging models 141
6.2 Nature of the point-spread function and noise 142
CONTENTS vii
6.3 Restoration by the inverse Fourier filter 143
6.4 The Wiener–Helstrom Filter 146
6.5 Origin of the Wiener–Helstrom filter 147
6.6 Acceptable solutions to the imaging equation 151
6.7 Constrained deconvolution 151
6.8 Estimating an unknown point-spread function or optical transfer
function 154
6.9 Blind deconvolution 156
6.10 Iterative deconvolution and the Lucy–Richardson algorithm 158
6.11 Matrix formulation of image restoration 161
6.12 The standard least-squares solution 162
6.13 Constrained least-squares restoration 163
6.14 Stochastic input distributions and Bayesian estimators 165
6.15 The generalized Gauss–Markov estimator 165
7 Geometry 169
7.1 The description of shape 169
7.2 Shape-preserving transformations 170
7.3 Shape transformation and homogeneous coordinates 171
7.4 The general 2-D affine transformation 173
7.5 Affine transformation in homogeneous coordinates 174
7.6 The Procrustes transformation 175
7.7 Procrustes alignment 176
7.8 The projective transform 180
7.9 Nonlinear transformations 184
7.10 Warping: the spatial transformation of an image 186
7.11 Overdetermined spatial transformations 189
7.12 The piecewise warp 191
7.13 The piecewise affine warp 191
7.14 Warping: forward and reverse mapping 194
8 Morphological processing 197
8.1 Introduction 197
8.2 Binary images: foreground, background and connectedness 197
8.3 Structuring elements and neighbourhoods 198
8.4 Dilation and erosion 200
8.5 Dilation, erosion and structuring elements within Matlab 201
8.6 Structuring element decomposition and Matlab 202
8.7 Effects and uses of erosion and dilation 204
8.7.1 Application of erosion to particle sizing 207
8.8 Morphological opening and closing 209
8.8.1 The rolling-ball analogy 210
8.9 Boundary extraction 212
8.10 Extracting connected components 213
viii CONTENTS
8.11 Region filling 215
8.12 The hit-or-miss transformation 216
8.12.1 Generalization of hit-or-miss 219
8.13 Relaxing constraints in hit-or-miss: ‘don’t care’ pixels 220
8.13.1 Morphological thinning 222
8.14 Skeletonization 222
8.15 Opening by reconstruction 224
8.16 Grey-scale erosion and dilation 227
8.17 Grey-scale structuring elements: general case 227
8.18 Grey-scale erosion and dilation with flat structuring elements 228
8.19 Grey-scale opening and closing 229
8.20 The top-hat transformation 230
8.21 Summary 231
Exercises 233
9 Features 235
9.1 Landmarks and shape vectors 235
9.2 Single-parameter shape descriptors 237
9.3 Signatures and the radial Fourier expansion 239
9.4 Statistical moments as region descriptors 243
9.5 Texture features based on statistical measures 246
9.6 Principal component analysis 247
9.7 Principal component analysis: an illustrative example 247
9.8 Theory of principal component analysis: version 1 250
9.9 Theory of principal component analysis: version 2 251
9.10 Principal axes and principal components 253
9.11 Summary of properties of principal component analysis 253
9.12 Dimensionality reduction: the purpose of principal
component analysis 256
9.13 Principal components analysis on an ensemble of digital images 257
9.14 Representation of out-of-sample examples using principal
component analysis 257
9.15 Key example: eigenfaces and the human face 259
10 Image Segmentation 263
10.1 Image segmentation 263
10.2 Use of image properties and features in segmentation 263
10.3 Intensity thresholding 265
10.3.1 Problems with global thresholding 266
10.4 Region growing and region splitting 267
10.5 Split-and-merge algorithm 267
10.6 The challenge of edge detection 270
10.7 The Laplacian of Gaussian and difference of Gaussians filters 270
10.8 The Canny edge detector 271
CONTENTS ix
10.9 Interest operators 274
10.10 Watershed segmentation 279
10.11 Segmentation functions 280
10.12 Image segmentation with Markov random fields 286
10.12.1 Parameter estimation 288
10.12.2 Neighbourhood weighting parameter un 289
10.12.3 Minimizing U(x | y): the iterated conditional
modes algorithm 290
11 Classification 291
11.1 The purpose of automated classification 291
11.2 Supervised and unsupervised classification 292
11.3 Classification: a simple example 292
11.4 Design of classification systems 294
11.5 Simple classifiers: prototypes and minimum distance
criteria 296
11.6 Linear discriminant functions 297
11.7 Linear discriminant functions in N dimensions 301
11.8 Extension of the minimum distance classifier and the
Mahalanobis distance 302
11.9 Bayesian classification: definitions 303
11.10 The Bayes decision rule 304
11.11 The multivariate normal density 306
11.12 Bayesian classifiers for multivariate normal distributions 307
11.12.1 The Fisher linear discriminant 310
11.12.2 Risk and cost functions 311
11.13 Ensemble classifiers 312
11.13.1 Combining weak classifiers: the AdaBoost method 313
11.14 Unsupervised learning: k-means clustering 313
Further reading 317
Index 319
x CONTENTS
Preface
Scope of this book
This is an introductory text on the science (and art) of image processing. The book also
employs the Matlab programming language and toolboxes to illuminate and consolidate
some of the elementary but key concepts in modern image processing and pattern
recognition.
The authors are firm believers in the old adage, “Hear and forget. . ., See and remember. . .,
Do and know”. For most of us, it is through good examples and gently guided experimenta-
tion that we really learn. Accordingly, the book has a large number of carefully chosen
examples, graded exercises and computer experiments designed to help the reader get a real
grasp of the material. All the program code (.m files) used in the book, corresponding to the
examples and exercises, are made available to the reader/course instructor and may be
downloaded from the book’s dedicated web site – www.fundipbook.com.
Who is this book for?
For undergraduate and graduate students in the technical disciplines, for technical
professionals seeking a direct introduction to the field of image processing and for
instructors looking to provide a hands-on, structured course. This book intentionally
starts with simple material but we also hope that relative experts will nonetheless find some
interesting and useful material in the latter parts.
Aims
What then are the specific aims of this book ? Two of the principal aims are –
. To introduce the reader to some of the key concepts and techniques of modern image
processing.
. To provide a framework within which these concepts and techniques can be understood
by a series of examples, exercises and computer experiments.
These are, perhaps, aims which one might reasonably expect from any book on a technical
subject. However, we have one further aim namely to provide the reader with the fastest,
most direct route to acquiring a real hands-on understanding of image processing. We hope
this book will give you a real fast-start in the field.
Assumptions
We make no assumptions about the reader’s mathematical background beyond that
expected at the undergraduate level in the technical sciences – ie reasonable competence
in calculus, matrix algebra and basic statistics.
Why write this book?
There are already a number of excellent and comprehensive texts on image processing and
pattern recognition and we refer the interested reader to a number in the appendices of this
book. There are also some exhaustive and well-written books on the Matlab language. What
the authors felt was lacking was an image processing book which combines a simple exposition
of principles with a means to quickly test, verify and experiment with them in an instructive and
interactive way.
In our experience, formed over a number of years, Matlab and the associated image
processing toolbox are extremely well-suited to help achieve this aim. It is simple but
powerful and its key feature in this context is that it enables one to concentrate on the image
processing concepts and techniques (i.e. the real business at hand) while keeping concerns
about programming syntax and data management to a minimum.
What is Matlab?
Matlab is a programming language with an associated set of specialist software toolboxes.
It is an industry standard in scientific computing and used worldwide in the scientific,
technical, industrial and educational sectors. Matlab is a commercial product and
information on licences and their cost can be obtained direct by enquiry at the
web-site www.mathworks.com. Many Universities all over the world provide site licenses
for their students.
What knowledge of Matlab is required for this book?
Matlab is very much part of this book and we use it extensively to demonstrate how
certain processing tasks and approaches can be quickly implemented and tried out in
practice. Throughout the book, we offer comments on the Matlab language and the best
way to achieve certain image processing tasks in that language. Thus the learning of
concepts in image processing and their implementation within Matlab go hand-in-hand
in this text.
xii PREFACE
Is the book any use then if I don’t know Matlab?
Yes. This is fundamentally a book about image processing which aims to make the subject
accessible and practical. It is not a book about the Matlab programming language. Although
some prior knowledge of Matlab is an advantage and will make the practical implementa-
tion easier, we have endeavoured to maintain a self-contained discussion of the concepts
which will stand up apart from the computer-based material.
If you have not encountered Matlab before and you wish to get the maximum from
this book, please refer to the Matlab and Image Processing primer on the book website
(http://www.fundipbook.com). This aims to give you the essentials on Matlab with a
strong emphasis on the basic properties and manipulation of images.
Thus, you do not have to be knowledgeable in Matlab to profit from this book.
Practical issues
To carry out the vast majority of the examples and exercises in the book, the reader will need
access to a current licence for Matlab and the Image Processing Toolbox only.
Features of this book and future support
This book is accompanied by a dedicated website (http://www.fundipbook.com). The site is
intended to act as a point of contact with the authors, as a repository for the code examples
(Matlab .m files) used in the book and to host additional supporting materials for the reader
and instructor.
About the authors
Chris Solomon gained a B.Sc in theoretical physics from Durham University and a Ph.D in
Medical imaging from the Royal Marsden Hospital, University of London. Since 1994, he
has been on the Faculty at the School of Physical Sciences where he is currently a Reader in
Forensic Imaging. He has broad research interests focussing on evolutionary and genetic
algorithms, image processing and statistical learning methods with a special interest in the
human face. Chris is also Technical Director of Visionmetric Ltd, a company he founded in
1999 and which is now the UK’s leading provider of facial composite software and training
in facial identification to police forces. He has received a number of UK and European
awards for technology innovation and commercialisation of academic research.
Toby Breckon holds a Ph.D in Informatics and B.Sc in Artificial Intelligence and
Computer Science from the University of Edinburgh. Since 2006 he has been a lecturer in
image processing and computer vision in the School of Engineering at Cranfield University.
His key research interests in this domain relate to 3D sensing, real-time vision, sensor
fusion, visual surveillance and robotic deployment. He is additionally a visiting member
of faculty at Ecole Sup
erieure des Technologies Industrielles Avanc
ees (France) and has
held visiting faculty positions in China and Japan. In 2008 he led the development of
PREFACE xiii
image-based automatic threat detection for the winning Stellar Team system in the UK
MoD Grand Challenge. He is a Chartered Engineer (CEng) and an Accredited Imaging
Scientist (AIS) as an Associate of the Royal Photographic Society (ARPS).
Thanks
The authors would like to thank the following people and organisations for their various
support and assistance in the production of this book: the authors families and friends for
their support and (frequent) understanding, Professor Chris Dainty (National University of
Ireland), Dr. Stuart Gibson (University of Kent), Dr. Timothy Lukins (University of
Edinburgh), The University of Kent, Cranfield University, VisionMetric Ltd and Wiley-
Blackwell Publishers.
For further examples and exercises see http://www.fundipbook.com
xiv PREFACE
Using the book website
There is an associated website which forms a vital supplement to this text. It is:
www.fundipbook.com
The material on the site is mostly organised by chapter number and this contains –
EXERCISES: intended to consolidate and highlight concepts discussed in the text. Some of
these exercises are numerical/conceptual, others are based on Matlab.
SUPPLEMENTARY MATERIAL: Proofs, derivations and other supplementary material
referred to in the text are available from this section and are intended to consolidate,
highlight and extend concepts discussed in the text.
Matlab CODE: The Matlab code to all the examples in the book as well as the code used to
create many of the figures are available in the Matlab code section.
IMAGE DATABASE: The Matlab software allows direct access and use to a number of
images as an integral part of the software. Many of these are used in the examples presented
in the text.
We also offer a modest repository of images captured and compiled by the authors which
the reader may freely download and work with. Please note that some of the example Matlab
code contained on the website and presented in the text makes use of these images. You will
therefore need to download these images to run some of the Matlab code shown.
We strongly encourage you to make use of the website and the materials on it. It is a vital
link to making your exploration of the subject both practical and more in-depth. Used
properly, it will help you to get much more from this book.
1
Representation
In this chapter we discuss the representation of images, covering basic notation and
information about images together with a discussion of standard image types and image
formats. We end with a practical section, introducing Matlab’s facilities for reading, writing,
querying, converting and displaying images of different image types and formats.
1.1 What is an image?
A digital image can be considered as a discrete representation of data possessing both spatial
(layout) and intensity (colour) information. As we shall see in Chapter 5, we can also
consider treating an image as a multidimensional signal.
1.1.1 Image layout
The two-dimensional (2-D) discrete, digital image Iðm; nÞ represents the response of some
sensor (or simply a value of some interest) at a series of fixed positions
(m ¼ 1; 2; . . . ; M; n ¼ 1; 2; . . . ; N) in 2-D Cartesian coordinates and is derived from the
2-D continuous spatial signal Iðx; yÞ through a sampling process frequently referred to as
discretization. Discretization occurs naturally with certain types of imaging sensor (such as
CCD cameras) and basically effects a local averaging of the continuous signal over some
small (typically square) region in the receiving domain.
The indices m and n respectively designate the rows and columns of the image. The
individual picture elements or pixels of the image are thus referred to by their 2-D ðm; nÞ
index. Following the Matlab
convention, Iðm; nÞ denotes the response of the pixel
located at the mth row and nth column starting from a top-left image origin (see
Figure 1.1). In other imaging systems, a column–row convention may be used and the
image origin in use may also vary.
Although the images we consider in this book will be discrete, it is often theoretically
convenient to treat an image as a continuous spatial signal: Iðx; yÞ. In particular, this
sometimes allows us to make more natural use of the powerful techniques of integral and
differential calculus to understand properties of images and to effectively manipulate and
Fundamentals of Digital Image Processing A Practical Approach with Examples in Matlab
Chris Solomon and Toby Breckon
 2011 John Wiley  Sons, Ltd
process them. Mathematical analysis of discrete images generally leads to a linear algebraic
formulation which is better in some instances.
The individual pixel values in most images do actually correspond to some physical
response in real 2-D space (e.g. the optical intensity received at the image plane of a camera
or the ultrasound intensity at a transceiver). However, we are also free to consider images in
abstract spaces where the coordinates correspond to something other than physical space
and we may also extend the notion of an image to three or more dimensions. For example,
medical imaging applications sometimes consider full three-dimensional (3-D) recon-
struction of internal organs and a time sequence of such images (such as a beating heart) can
be treated (if we wish) as a single four-dimensional (4-D) image in which three coordinates
are spatial and the other corresponds to time. When we consider 3-D imaging we are often
discussing spatial volumes represented by the image. In this instance, such 3-D pixels are
denoted as voxels (volumetric pixels) representing the smallest spatial location in the 3-D
volume as opposed to the conventional 2-D image.
Throughout this book we will usually consider 2-D digital images, but much of our
discussion will be relevant to images in higher dimensions.
1.1.2 Image colour
An image contains one or more colour channels that define the intensity or colour at a
particular pixel location Iðm; nÞ.
In the simplest case, each pixel location only contains a single numerical value
representing the signal level at that point in the image. The conversion from this set of
numbers to an actual (displayed) image is achieved through a colour map. A colour map
assigns a specific shade of colour to each numerical level in the image to give a visual
representation of the data. The most common colour map is the greyscale, which assigns
all shades of grey from black (zero) to white (maximum) according to the signal level. The
Figure 1.1 The 2-D Cartesian coordinate space of an M x N digital image
2 CH 1 REPRESENTATION
greyscale is particularly well suited to intensity images, namely images which express only
the intensity of the signal as a single value at each point in the region.
In certain instances, it can be better to display intensity images using a false-colour map.
One of the main motives behind the use of false-colour display rests on the fact that the
human visual system is only sensitive to approximately 40 shades of grey in the range from
black to white, whereas our sensitivity to colour is much finer. False colour can also serve to
accentuate or delineate certain features or structures, making them easier to identify for the
human observer. This approach is often taken in medical and astronomical images.
Figure 1.2 shows an astronomical intensity image displayed using both greyscale and a
particular false-colour map. In this example the jet colour map (as defined in Matlab) has
been used to highlight the structure and finer detail of the image to the human viewer using a
linear colour scale ranging from dark blue (low intensity values) to dark red (high intensity
values). The definition of colour maps, i.e. assigning colours to numerical values, can be
done in any way which the user finds meaningful or useful. Although the mapping between
the numerical intensity value and the colour or greyscale shade is typically linear, there are
situations in which a nonlinear mapping between them is more appropriate. Such nonlinear
mappings are discussed in Chapter 4.
In addition to greyscale images where we have a single numerical value at each
pixel location, we also have true colour images where the full spectrum of colours can
be represented as a triplet vector, typically the (R,G,B) components at each pixel
location. Here, the colour is represented as a linear combination of the basis colours or
values and the image may be considered as consisting of three 2-D planes. Other
representations of colour are also possible and used quite widely, such as the (H,S,V)
(hue, saturation and value (or intensity)). In this representation, the intensity V of the
colour is decoupled from the chromatic information, which is contained within the H
and S components (see Section 1.4.2).
1.2 Resolution and quantization
The size of the 2-D pixel grid together with the data size stored for each individual image
pixel determines the spatial resolution and colour quantization of the image.
Figure 1.2 Example of grayscale (left) and false colour (right) image display (See colour plate section
for colour version)
1.2 RESOLUTION AND QUANTIZATION 3
The representational power (or size) of an image is defined by its resolution. The
resolution of an image source (e.g. a camera) can be specified in terms of three quantities:
. Spatial resolution The column (C) by row (R) dimensions of the image define the
numberofpixelsusedtocoverthevisualspacecapturedbytheimage.Thisrelatestothe
sampling of the image signal and is sometimes referred to as the pixel or digital
resolution of the image. It is commonly quoted as C  R (e.g. 640  480, 800  600,
1024  768, etc.)
. Temporal resolution For a continuous capture system such as video, this is the number of
images captured in a given time period. It is commonly quoted in frames per second
(fps), where each individual image is referred to as a video frame (e.g. commonly
broadcast TV operates at 25 fps; 25–30 fps is suitable for most visual surveillance; higher
frame-rate cameras are available for specialist science/engineering capture).
. Bit resolution This defines the number of possible intensity/colour values that a pixel
may have and relates to the quantization of the image information. For instance a binary
image has just two colours (black or white), a grey-scale image commonly has 256
different grey levels ranging from black to white whilst for a colour image it depends on
the colour range in use. The bit resolution is commonly quoted as the number of binary
bits required forstorage at a given quantization level, e.g. binary is 2bit, grey-scale is 8bit
and colour (most commonly) is 24 bit. The range of values a pixel may take is often
referred to as the dynamic range of an image.
It is important to recognize that the bit resolution of an image does not necessarily
correspond to the resolution of the originating imaging system. A common feature of many
cameras is automatic gain, in which the minimum and maximum responses over the image
field are sensed and this range is automatically divided into a convenient number of bits (i.e.
digitized into N levels). In such a case, the bit resolution of the image is typically less than
that which is, in principle, achievable by the device.
By contrast, the blind, unadjusted conversion of an analog signal into a given number of
bits, for instance 216
¼ 65 536 discrete levels, does not, of course, imply that the true
resolution of the imaging device as a whole is actually 16 bits. This is because the overall level
of noise (i.e. random fluctuation) in the sensor and in the subsequent processing chain may
be of a magnitude which easily exceeds a single digital level. The sensitivity of an imaging
system is thus fundamentally determined by the noise, and this makes noise a key factor in
determining the number of quantization levels used for digitization. There is no point in
digitizing an image to a high number of bits if the level of noise present in the image sensor
does not warrant it.
1.2.1 Bit-plane splicing
The visual significance of individual pixel bits in an image can be assessed in a subjective but
useful manner by the technique of bit-plane splicing.
To illustrate the concept, imagine an 8-bit image which allows integer values from 0 to
255. This can be conceptually divided into eight separate image planes, each corresponding
4 CH 1 REPRESENTATION
Figure 1.3 An example of bit-plane slicing a grey-scale image
to the values of a given bit across all of the image pixels. The first bit plane comprises the first
and most significant bit of information (intensity ¼ 128), the second, the second most
significant bit (intensity ¼ 64) and so on. Displaying each of the bit planes in succession, we
may discern whether there is any visible structure in them.
In Figure 1.3, we show the bit planes of an 8-bit grey-scale image of a car tyre descending
from the most significant bit to the least significant bit. It is apparent that the two or three
least significant bits do not encode much useful visual information (it is, in fact, mostly
noise). The sequence of images on the right in Figure 1.3 shows the effect on the original
image of successively setting the bit planes to zero (from the first and most significant to the
least significant). In a similar fashion, we see that these last bits do not appear to encode any
visible structure. In this specific case, therefore, we may expect that retaining only the five
most significant bits will produce an image which is practically visually identical to the
original. Such analysis could lead us to a more efficient method of encoding the image using
fewer bits – a method of image compression. We will discuss this next as part of our
examination of image storage formats.
1.3 Image formats
From a mathematical viewpoint, any meaningful 2-D array of numbers can be considered
as an image. In the real world, we need to effectively display images, store them (preferably
1.3 IMAGE FORMATS 5
compactly), transmit them over networks and recognize bodies of numerical data as
corresponding to images. This has led to the development of standard digital image
formats. In simple terms, the image formats comprise a file header (containing informa-
tion on how exactly the image data is stored) and the actual numeric pixel values
themselves. There are a large number of recognized image formats now existing, dating
back over more than 30 years of digital image storage. Some of the most common 2-D
image formats are listed in Table 1.1. The concepts of lossy and lossless compression are
detailed in Section 1.3.2.
As suggested by the properties listed in Table 1.1, different image formats are generally
suitable for different applications. GIF images are a very basic image storage format limited
to only 256 grey levels or colours, with the latter defined via a colour map in the file header as
discussed previously. By contrast, the commonplace JPEG format is capable of storing up to
a 24-bit RGB colour image, and up to 36 bits for medical/scientific imaging applications,
and is most widely used for consumer-level imaging such as digital cameras. Other common
formats encountered include the basic bitmap format (BMP), originating in the develop-
ment of the Microsoft Windows operating system, and the new PNG format, designed as a
more powerful replacement for GIF. TIFF, tagged image file format, represents an
overarching and adaptable file format capable of storing a wide range of different image
data forms. In general, photographic-type images are better suited towards JPEG or TIF
storage, whilst images of limited colour/detail (e.g. logos, line drawings, text) are best suited
to GIF or PNG (as per TIFF), as a lossless, full-colour format, is adaptable to the majority of
image storage requirements.
1.3.1 Image data types
The choice of image format used can be largely determined by not just the image contents,
but also the actual image data type that is required for storage. In addition to the bit
resolution of a given image discussed earlier, a number of distinct image types also exist:
. Binary images are 2-D arrays that assign one numerical value from the set f0; 1g to each
pixel in the image. These are sometimes referred to as logical images: black corresponds
Table 1.1 Common image formats and their associated properties
Acronym Name Properties
GIF Graphics interchange format Limited to only 256 colours (8 bit); lossless
compression
JPEG Joint Photographic Experts Group In most common use today; lossy
compression; lossless variants exist
BMP Bit map picture Basic image format; limited (generally)
lossless compression; lossy variants exist
PNG Portable network graphics New lossless compression format; designed
to replace GIF
TIF/TIFF Tagged image (file) format Highly flexible, detailed and adaptable
format; compressed/uncompressed variants
exist
6 CH 1 REPRESENTATION
to zero (an ‘off’ or ‘background’ pixel) and white corresponds to one (an ‘on’ or
‘foreground’ pixel). As no other values are permissible, these images can be represented
as a simple bit-stream, but in practice they are represented as 8-bit integer images in the
common image formats. A fax (or facsimile) image is an example of a binary image.
. Intensity or grey-scale images are 2-D arrays that assign one numerical value to each
pixel which is representative of the intensity at this point. As discussed previously, the
pixel value range is bounded by the bit resolution of the image and such images are
stored as N-bit integer images with a given format.
. RGB or true-colour images are 3-D arrays that assign three numerical values to each
pixel, each value corresponding to the red, green and blue (RGB) image channel
component respectively. Conceptually, we may consider them as three distinct, 2-D
planes so that they are of dimension C by R by 3, where R is the number of image rows
and C the number of image columns. Commonly, such images are stored as sequential
integers in successive channel order (e.g. R0G0B0, R1G1B1, . . .) which are then accessed
(as in Matlab) by IðC; R; channelÞ coordinates within the 3-D array. Other colour
representations which we will discuss later are similarly stored using the 3-D array
concept, which can also be extended (starting numerically from 1 with Matlab arrays) to
four or more dimensions to accommodate additional image information, such as an
alpha (transparency) channel (as in the case of PNG format images).
. Floating-point images differ from the other image types we have discussed. By defini-
tion, they do not store integer colour values. Instead, they store a floating-point number
which, within a given range defined by the floating-point precision of the image bit-
resolution, represents the intensity. They may (commonly) represent a measurement
value other than simple intensity or colour as part of a scientific or medical image.
Floating point images are commonly stored in the TIFF image format or a more
specialized, domain-specific format (e.g. medical DICOM). Although the use of
floating-point images is increasing through the use of high dynamic range and stereo
photography, file formats supporting their storage currently remain limited.
Figure 1.4 shows an example of the different image data types we discuss with an example
of a suitable image format used for storage. Although the majority of images we will
encounter in this text will be of integer data types, Matlab, as a general matrix-based data
analysis tool, can of course be used to process floating-point image data.
1.3.2 Image compression
The other main consideration in choosing an image storage format is compression. Whilst
compressing an image can mean it takes up less disk storage and can be transferred over a
network in less time, several compression techniques in use exploit what is known as lossy
compression.Lossycompressionoperatesbyremovingredundantinformationfromtheimage.
As the example of bit-plane slicing in Section 1.2.1 (Figure 1.3) shows, it is possible to
remove some information from an image without any apparent change in its visual
1.3 IMAGE FORMATS 7
appearance. Essentially, if such information is visually redundant then its transmission is
unnecessary for appreciation of the image. The form of the information that can be removed
is essentially twofold. It may be in terms of fine image detail (as in the bit-slicing example) or
it may be through a reduction in the number of colours/grey levels in a way that is not
detectable by the human eye.
Some of the image formats we have presented, store the data in such a compressed form
(Table 1.1). Storage of an image in one of the compressed formats employs various
algorithmic procedures to reduce the raw image data to an equivalent image which appears
identical (or at least nearly) but requires less storage. It is important to distinguish between
compression which allows the original image to be reconstructed perfectly from the reduced
data without any loss of image information (lossless compression) and so-called lossy
compression techniques which reduce the storage volume (sometimes dramatically) at
the expense of some loss of detail in the original image as shown in Figure 1.5, the lossless
and lossy compression techniques used in common image formats can significantly reduce
the amount of image information that needs to be stored, but in the case of lossy
compression this can lead to a significant reduction in image quality.
Lossy compression is also commonly used in video storage due to the even larger volume
of source data associated with a large sequence of image frames. This loss of information,
itself a form of noise introduced into the image as compression artefacts, can limit the
effectiveness of later image enhancement and analysis.
Figure 1.4 Examples of different image types and their associated storage formats
8 CH 1 REPRESENTATION
In terms of practical image processing in Matlab, it should be noted that an image written
to file from Matlab in a lossy compression format (e.g. JPEG) will not be stored as the exact
Matlab image representation it started as. Image pixel values will be altered in the image
output process as a result of the lossy compression. This is not the case if a lossless
compression technique is employed.
An interesting Matlab exercise is posed for the reader in Exercise 1.4 to illustrate this
difference between storage in JPEG and PNG file formats.
1.4 Colour spaces
Aswasbrieflymentionedinourearlierdiscussionofimagetypes,therepresentationofcolours
inanimageisachievedusingacombinationofoneormorecolourchannelsthatarecombined
toformthecolourusedintheimage.Therepresentationweusetostorethecolours,specifying
the number and nature of the colour channels, is generally known as the colour space.
Considered as a mathematical entity, an image is really only a spatially organized set of
numbers with each pixel location addressed as IðC; RÞ. Grey-scale (intensity) or binary
images are 2-D arrays that assign one numerical value to each pixel which isrepresentative of
Figure 1.5 Example image compressed using lossless and varying levels of lossy compression (See
colour plate section for colour version)
1.4 COLOUR SPACES 9
Figure 1.6 Colour RGB image separated into its red (R), green (G) and blue (B) colour channels (See
colour plate section for colour version)
the intensity at that point. They use a single-channel colour space that is either limited to a
2-bit (binary) or intensity (grey-scale) colour space. By contrast, RGB or true-colour images
are 3-D arrays that assign three numerical values to each pixel, each value corresponding to
the red, green and blue component respectively.
1.4.1 RGB
RGB (or true colour) images are 3-D arrays that we may consider conceptually as three
distinct 2-D planes, one corresponding to each of the three red (R), green (G) and blue (B)
colour channels. RGB is the most common colour space used for digital image representa-
tion as it conveniently corresponds to the three primary colours which are mixed for display
on a monitor or similar device.
We can easily separate and view the red, green and blue components of a true-colour
image, as shown in Figure 1.6. It is important to note that the colours typically present in a
real image are nearly always a blend of colour components from all three channels. A
common misconception is that, for example, items that are perceived as blue will only
appear in the blue channel and so forth. Whilst items perceived as blue will certainly appear
brightest in the blue channel (i.e. they will contain more blue light than the other colours)
they will also have milder components of red and green.
If we consider all the colours that can be represented within the RGB representation, then
we appreciate that the RGB colour space is essentially a 3-D colour space (cube) with axes R,
G and B (Figure 1.7). Each axis has the same range 0 ! 1 (this is scaled to 0–255 for the
common 1 byte per colour channel, 24-bit image representation). The colour black occupies
the origin of the cube (position ð0; 0; 0Þ), corresponding to the absence of all three colours;
white occupies the opposite corner (position ð1; 1; 1Þ), indicating the maximum amount of
all three colours. All other colours in the spectrum lie within this cube.
The RGB colour space is based upon the portion of the electromagnetic spectrum visible
to humans (i.e. the continuous range of wavelengths in the approximate range
10 CH 1 REPRESENTATION
Figure 1.7 Anillustration ofRGBcolourspaceasa3-Dcube(Seecolourplatesectionforcolour version)
400–700 nm). The human eye has three different types of colour receptor over which it has
limited (and nonuniform) absorbency for each of the red, green and blue wavelengths. This
is why, as we will see later, the colour to grey-scale transform uses a nonlinear combination
of the RGB channels.
In digital image processing we use a simplified RGB colour model (based on the CIE
colour standard of 1931) that is optimized and standardized towards graphical displays.
However, the primary problem with RGB is that it is perceptually nonlinear. By this we
mean that moving in a given direction in the RGB colour cube (Figure 1.7) does not
necessarily produce a colour that is perceptually consistent with the change in each of the
channels. For example, starting at white and subtracting the blue component produces
yellow; similarly, starting at red and adding the blue component produces pink. For this
reason, RGB space is inherently difficult for humans to work with and reason about because
it is not related to the natural way we perceive colours. As an alternative we may use
perceptual colour representations such as HSV.
1.4.1.1 RGB to grey-scale image conversion
We can convert from an RGB colour space to a grey-scale image using a simple transform.
Grey-scale conversion is the initial step in many image analysis algorithms, as it essentially
simplifies (i.e. reduces) the amount of information in the image. Although a grey-scale
image contains less information than a colour image, the majority of important, feature-
related information is maintained, such as edges, regions, blobs, junctions and so on.
Feature detection and processing algorithms then typically operate on the converted grey-
scale version of the image. As we can see from Figure 1.8, it is still possible to distinguish
between the red and green apples in grey-scale.
An RGB colour image, Icolour, is converted to grey scale, Igrey-scale, using the following
transformation:
Igrey-scaleðn; mÞ ¼ aIcolourðn; m; rÞ þ bIcolourðn; m; gÞ þ gIcolourðn; m; bÞ ð1:1Þ
1.4 COLOUR SPACES 11
Figure 1.8 An example of RGB colour image (left) to grey-scale image (right) conversion (See colour
plate section for colour version)
where ðn; mÞ indexes an individual pixel within the grey-scale image and ðn; m; cÞ the
individual channel at pixel location ðn; mÞ in the colour image for channel c in the red r, blue
b and green g image channels. As is apparent from Equation (1.1), the grey-scale image is
essentially a weighted sum of the red, green and blue colour channels. The weighting
coefficients (a, b and g) are set in proportion to the perceptual response of the human eye to
each of the red, green and blue colour channels and a standardized weighting ensures
uniformity (NTSC television standard, a ¼ 0.2989, b ¼ 0.5870 and g ¼ 0.1140). The human
eye is naturally more sensitive to red and green light; hence, these colours are given higher
weightings to ensure that the relative intensity balance in the resulting grey-scale image is
similar to that of the RGB colour image. An example of performing a grey-scale conversion
in Matlab is given in Example 1.6.
RGB to grey-scale conversion is a noninvertible image transform: the true colour
information that is lost in the conversion cannot be readily recovered.
1.4.2 Perceptual colour space
Perceptual colour space is an alternative way of representing true colour images in a manner
that is more natural to the human perception and understanding of colour than the RGB
representation. Many alternative colour representations exist, but here we concentrate on
the Hue, Saturation and Value (HSV) colour space popular in image analysis applications.
Changes within this colour space follow a perceptually acceptable colour gradient. From
an image analysis perspective, it allows the separation of colour from lighting to a greater
degree. An RGB image can be transformed into an HSV colour space representation as
shown in Figure 1.9.
Each of these three parameters can be interpreted as follows:
. H (hue) is the dominant wavelength of the colour, e.g. red, blue, green
. S (saturation) is the ‘purity’ of colour (in the sense of the amount of white light mixed
with it)
. V (value) is the brightness of the colour (also known as luminance).
12 CH 1 REPRESENTATION
The HSV representation of a 2-D image is also as a 3-D array comprising three channels
ðh; s; vÞ and each pixel location within the image, Iðn; mÞ, contains an ðh; s; vÞ triplet
that can be transformed back into RGB for true-colour display. In the Matlab HSV
implementation each of h, s and v are bounded within the range 0 ! 1. For example, a
blue hue (top of cone, Figure 1.9) may have a value of h ¼ 0.9, a saturation of s ¼ 0.5 and a
value v ¼ 1 making it a vibrant, bright sky-blue.
By examining the individual colour channels of images in the HSV space, we can see
that image objects are more consistently contained in the resulting hue field than in the
channels of the RGB representation, despite the presence of varying lighting conditions
over the scene (Figure 1.10). As a result, HSV space is commonly used for colour-based
Figure 1.9 HSV colour space as a 3-D cone (See colour plate section for colour version)
Figure 1.10 Image transformed and displayed in HSV colour space (See colour plate section for colour
version)
1.4 COLOUR SPACES 13
image segmentation using a technique known as colour slicing. A portion of the hue
colour wheel (a slice of the cone, Figure 1.9) is isolated as the colour range of interest,
allowing objects within that colour range to be identified within the image. This ease of
colour selection in HSV colour space also results in its widespread use as the preferred
method of colour selection in computer graphical interfaces and as a method of adding
false colour to images (Section 1.1.2).
Details of RGB to HSV image conversion in Matlab are given in Exercise 1.6.
1.5 Images in Matlab
Having introduced the basics of image representation, we now turn to the practical
aspect of this book to investigate the initial stages of image manipulation using Matlab.
These are presented as a number of worked examples and further exercises for the
reader.
1.5.1 Reading, writing and querying images
Reading and writing images is accomplished very simply via the imread and imwrite
functions. These functions support all of the most common image formats and create/
export the appropriate 2-D/3-D image arrays within the Matlab environment. The function
imfinfo can be used to query an image and establish all its important properties, including
its type, format, size and bit depth.
Example 1.1
Matlab code What is happening?
imfinfo(‘cameraman.tif ’) %Query the cameraman image that
%is available with Matlab
%imfinfo provides information
%ColorType is gray scale, width is 256 . . . etc.
I1¼imread(‘cameraman.tif ’); %Read in the TIF format cameraman image
imwrite(I1,’cameraman.jpg’,’jpg’); %Write the resulting array I1 to
%disk as a JPEG image
imfinfo(‘cameraman.jpg’) %Query the resulting disk image
%Note changes in storage size, etc.
Comments
. Matlab functions: imread, imwrite and iminfo.
. Note the change in file size when the image is stored as a JPEG image. This is due to the
(lossy) compression used by the JPEG image format.
14 CH 1 REPRESENTATION
1.5.2 Basic display of images
Matlab provides two basic functions for image display: imshow and imagesc. Whilst
imshow requires that the 2-D array specified for display conforms to an image data type
(e.g. intensity/colour images with value range 0–1 or 0–255), imagesc accepts input
arrays of any Matlab storage type (uint 8, uint 16 or double) and any numerical range.
This latter function then scales the input range of the data and displays it using the
current/default colour map. We can additionally control this display feature using the
colormap function.
Example 1.2
Matlab code What is happening?
A¼imread(‘cameraman.tif ’); %Read in intensity image
imshow(A); %First display image using imshow
imagesc(A); %Next display image using imagesc
axis image; %Correct aspect ratio of displayed image
axis off; %Turn off the axis labelling
colormap(gray); %Display intensity image in grey scale
Comments
. Matlab functions: imshow, imagesc and colormap.
. Note additional steps required when using imagesc to display conventional images.
In order to show the difference between the two functions we now attempt the display of
unconstrained image data.
Example 1.3
Matlab code What is happening?
B¼rand(256).
1000; %Generate random image array in range 0 1000
imshow(B); %Poor contrast results using imshow because data
%exceeds expected range
imagesc(B); %imagesc automatically scales colourmap to data
axis image; axis off; %range
colormap(gray); colorbar;
imshow(B,[0 1000]); %But if we specify range of data explicitly then
%imshow also displays correct image contrast
Comments
. Note the automatic display scaling of imagesc.
1.5 IMAGES IN MATLAB 15
If we wish to display multiple images together, this is best achieved by the subplot
function. This function creates a mosaic of axes into which multiple images or plots can be
displayed.
Example 1.4
Matlab code What is happening?
B¼imread(‘cell.tif ’); %Read in 8 bit intensity image of cell
C¼imread(‘spine.tif ’); %Read in 8 bit intensity image of spine
D¼imread(‘onion.png’); %Read in 8 bit colour image
subplot(3,1,1); imagesc(B); axis image; %Creates a 3  1 mosaic of plots
axis off; colormap(gray); %and display first image
subplot(3,1,2); imagesc(C); axis image; %Display second image
axis off; colormap(jet); %Set colourmap to jet (false colour)
subplot(3,1,3); imshow(D); %Display third (colour) image
Comments
. Note the specification of different colour maps using imagesc and the combined
display using both imagesc and imshow.
1.5.3 Accessing pixel values
Matlab also contains a built-in interactive image viewer which can be launched using the
imview function. Its purpose is slightly different from the other two: it is a graphical, image
viewer which is intended primarily for the inspection of images and sub-regions within
them.
Example 1.5
Matlab code What is happening?
B¼imread(‘cell.tif ’); %Read in 8 bit intensity image of cell
imview(B); %Examine grey scale image in interactive viewer
D¼imread(‘onion.png’); %Read in 8 bit colour image.
imview(B); %Examine RGB image in interactive viewer
B(25,50) %Print pixel value at location (25,50)
B(25,50)¼255; %Set pixel value at (25,50) to white
imshow(B); %View resulting changes in image
D(25,50,:) %Print RGB pixel value at location (25,50)
D(25,50, 1) %Print only the red value at (25,50)
16 CH 1 REPRESENTATION
D(25,50,:)¼(255, 255, 255); %Set pixel value to RGB white
imshow(D); %View resulting changes in image
Comments
. Matlab functions: imview.
. Note how we can access individual pixel values within the image and change their
value.
1.5.4 Converting image types
Matlab also contains built in functions for converting different image types. Here, we
examine conversion to grey scale and the display of individual RGB colour channels from an
image.
Example 1.6
Matlab code What is happening?
D¼imread(‘onion.png’); %Read in 8 bit RGB colour image
Dgray¼rgb2gray(D); %Convert it to a grey scale image
subplot(2,1,1); imshow(D); axis image; %Display both side by side
subplot(2,1,2); imshow(Dgray);
Comments
. Matlab functions: rgb2gray.
. Note how the resulting grayscale image array is 2 D while the originating colour
image array was 3 D.
Example 1.7
Matlab code What is happening?
D¼imread(‘onion.png’); %Read in 8 bit RGB colour image.
Dred¼D(:,:,1); %Extract red channel (first channel)
Dgreen¼D(:,:,2); %Extract green channel (second channel)
Dblue¼D(:,:,3); %Extract blue channel (third channel)
subplot(2,2,1); imshow(D); axis image; %Display all in 2  2 plot
subplot(2,2,2); imshow(Dred); title(‘red’); %Display and label
subplot(2,2,3); imshow(Dgreen); title(‘green’);
subplot(2,2,4); imshow(Dblue); title(‘blue’);
Comments
. Note how we can access individual channels of an RGB image and extract them as separate
images in their own right.
1.5 IMAGES IN MATLAB 17
Exercises
The following exercises are designed to reinforce and develop the concepts and Matlab
examples introduced in this chapter
Matlab functions: imabsdiff, rgb2hsv.
Exercise 1.1 Using the examples presented for displaying an image in Matlab together
with those for accessing pixel locations, investigate adding and subtracting a scalar value
from an individual location, i.e. Iði; jÞ ¼ Iði; jÞ þ 25 or Iði; jÞ ¼ Iði; jÞ25. Start by using the
grey-scale‘cell.tif’ example imageand pixel location ð100; 20Þ. What is the effecton the grey-
scale colour of adding and subtracting?
Expand your technique to RGB colour images by adding and subtracting to all three of
the colour channels in a suitable example image. Also try just adding to one of the individual
colour channels whilst leaving the others unchanged. What is the effect on the pixel colour
of each of these operations?
Exercise 1.2 Based on your answer to Exercise 1.1, use the for construct in Matlab (see help
for at the Matlab command prompt) to loop over all the pixels in the image and brighten or
darken the image.
You will need to ensure that your program does not try to create a pixel value that is larger
or smaller than the pixelcanhold. For instance,an 8-bitimage can only hold the values 0–255
at each pixel location and similarly for each colour channel for a 24-bit RGB colour image.
Exercise 1.3 Using the grey-scale ‘cell.tif’ example image, investigate using different false
colour maps to display the image. The Matlab function colormap can take a range of values
to specify different false colour maps: enter help graph3d and look under the Color maps
heading to get a full list. What different aspects and details of the image can be seen using
these false colourings in place of the conventional grey-scale display?
False colour maps can also be specified numerically as parameters to the colormap
command: enter help colormap for further details.
Exercise 1.4 Load an example image into Matlab and using the functions introduced in
Example 1.1 save it once as a JPEG format file (e.g. sample.jpg) and once as a PNG format
image (e.g. sample.png). Next, reload the images from both of these saved files as new
images in Matlab, ‘Ijpg’ and ‘Ipng’.
We may expect these two images to be exactly the same, as they started out as the same
image and were just saved in different image file formats. If we compare them by subtracting
one from the other and taking the absolute difference at each pixel location we can check
whether this assumption is correct.
Use the imabsdiff Matlab command to create a difference image between ‘Ijpg’ and
‘Ipng’. Display the resulting image using imagesc.
The difference between these two images is not all zeros as one may expect, but a noise
pattern related to the difference in the images introduced by saving in a lossy compression
format (i.e. JPEG) and a lossless compression format (i.e. PNG). The difference we see is due
18 CH 1 REPRESENTATION
to the image information removed in the JPEG version of the file which is not apparent to us
when we look at the image. Interestingly, if we view the difference image with imshow all we
see is a black image because the differences are so small they have very low (i.e. dark) pixel
values. The automatic scaling and false colour mapping of imagesc allows us to visualize
these low pixel values.
Exercise 1.5 Implement a program to perform the bit-slicing technique described in
Section 1.2.1 and extract/display the resulting plane images (Figure 1.3) as separate Matlab
images.
You may wish to consider displaying a mosaic of several different bit-planes from an
image using the subplot function.
Exercise 1.6 Using the Matlab rgb2hsv function, write a program to display the individual
hue, saturation and value channels of a given RGB colour image. You may wish to refer to
Example 1.6 on the display of individual red, green and blue channels.
For further examples and exercises see http://www.fundipbook.com
EXERCISES 19
2
Formation
All digital images have to originate from somewhere. In this chapter we consider the issue of
image formation both from a mathematical and an engineering perspective. The origin and
characteristics of an image can have a large bearing on how we can effectively process it.
2.1 How is an image formed?
The image formation process can be summarized as a small number of key elements. In
general, a digital image s can be formalized as a mathematical modelcomprising a functional
representation of the scene (the object function o)and that of the capture process(the point-
spread function (PSF) p). Additionally, the image will contain additive noise n. These are
essentially combined as follows to form an image:
Image ¼ PSF  object function þ noise
s ¼ p  o þ n
ð2:1Þ
In this process we have several key elements:
. PSF this describes the way information on the object function is spread as a result of
recording the data. It is a characteristic of the imaging instrument (i.e. camera) and is a
deterministic function (that operates in the presence of noise).
. Object function This describes the object (or scene) that is being imaged (its surface or
internal structure, for example) and the way light is reflected from that structure to the
imaging instrument.
. Noise This is a nondeterministic function which can, at best, only be described in terms
of some statistical noise distribution (e.g. Gaussian). Noise is a stochastic function
which is a consequence of all the unwanted external disturbances that occur during the
recording of the image data.
. Convolution operator  A mathematical operation which ‘smears’ (i.e. convolves) one
function with another.
Fundamentals of Digital Image Processing A Practical Approach with Examples in Matlab
Chris Solomon and Toby Breckon
 2011 John Wiley  Sons, Ltd
Here, the function of the light reflected from the object/scene (object function) is trans-
formed into the image data representation by convolution with the PSF. This function
characterizes the image formation (or capture) process. The process is affected by noise.
The PSF is a characteristic of the imaging instrument (i.e. camera). It represents the
response of the system to a point source in the object plane, as shown in Figure 2.1, where we
can also consider an imaging system as an input distribution (scene light) to output
distribution (image pixels) mapping function consisting both of the PSF itself and additive
noise (Figure 2.1 (lower)).
From this overview we will consider both the mathematical representation of the image
formation process (Section 2.2), useful as a basis for our later consideration of advanced
image-processing representations (Chapter 5), and from an engineering perspective in
terms of physical camera imaging (Section 2.3).
2.2 The mathematics of image formation
The formation process of an image can be represented mathematically. In our later
consideration of various processing approaches (see Chapters 3–6) this allows us to reason
mathematically using knowledge of the conditions under which the image originates.
2.2.1 Introduction
In a general mathematical sense, we may view image formation as a process which
transforms an input distribution into an output distribution. Thus, a simple lens may be
viewed as a ‘system’ that transforms a spatial distribution of light in one domain (the object
Figure 2.1 An overview of the image formation ‘system’ and the effect of the PSF
22 CH 2 FORMATION
plane) to a distribution in another (the image plane). Similarly, a medical ultrasound
imaging system transforms a set of spatially distributed acoustic reflection values into a
corresponding set of intensity signals which are visually displayed as a grey-scale intensity
image. Whatever the specific physical nature of the input and output distributions, the
concept of a mapping between an input distribution (the thing you want to investigate, see
or visualize) and an output distribution (what you actually measure or produce with your
system) is valid. The systems theory approach to imaging is a simple and convenient way of
conceptualizing the imaging process. Any imaging device isa system, or a‘black box’, whose
properties are defined by the way in which an input distribution is mapped to an output
distribution. Figure 2.2 summarizes this concept.
The process by which an imaging system transforms the input into an output can be
viewed from an alternative perspective, namely that of the Fourier or frequency domain.
From this perspective, images consist of a superposition of harmonic functions of different
frequencies. Imaging systems then act upon the spatial frequency content of the input to
produce an output with a modified spatial frequency content. Frequency-domain methods
are powerful and important in image processing, and we will offer a discussion of such
methods later in Chapter 5. First however, we are going to devote some time to
understanding the basic mathematics of image formation.
2.2.2 Linear imaging systems
Linear systems and operations are extremely important in image processing because the
majority of real-world imaging systems may be well approximated as linear systems.
Moreover, there is a thorough and well-understood body of theory relating to linear
systems. Nonlinear theory is still much less developed and understood, and deviations from
strict linearity are often best handled in practice by approximation techniques which exploit
the better understood linear methods.
An imaging system described by operator S is linear if for any two input distributions X
and Y and any two scalars a and b we have
SfaX þ bYg ¼ aSfXg þ bSfYg ð2:2Þ
In other words, applying the linear operator to a weighted sum of two inputs yields the
same result as first applying the operator to the inputs independently and then combining
the weighted outputs. To make this concept concrete, consider the two simple input
INPUT DISTRIBUTION I OUTPUT DISTRIBUTION O
SYSTEM S
S(I) = O
Figure 2.2 Systems approach to imaging. The imaging process is viewed as an operator S which acts
on the input distribution I to produce the output O
2.2 THE MATHEMATICS OF IMAGE FORMATION 23
distributions depicted in Figure 2.3 consisting of a cross and a circle. These radiate some
arbitrary flux (optical photons, X-rays, ultrasonic waves or whatever) which are imper-
fectly imaged by our linear system. The first row of Figure 2.3 shows the two input
distributions, their sum and then the result of applying the linear operator (a blur) to the
sum. The second row shows the result of first applying the operator to the individual
distributions and then the result of summing them. In each case the final result is the same.
The operator applied in Figure 2.3 is a convolution with Gaussian blur, a topic we will
expand upon shortly.
2.2.3 Linear superposition integral
Consider Figure 2.4, in which we have some general 2-D input function f ðx0
; y0
Þ in an input
domain ðx0
; y0
Þ and the 2-D response gðx; yÞ of our imaging system to this input in the
output domain ðx; yÞ. In the most general case, we should allow for the possibility that each
and every point in the input domain may contribute in some way to the output. If the system
is linear, however, the contributions to the final output must combine linearly. For this
reason, basic linear image formation is described by an integral operator which is called the
linear superposition integral:
gðx; yÞ ¼
Z Z
f ðx0
; y0
Þhðx; y; x0
; y0
Þ dx0
dy0
ð2:3Þ
This integral actually expresses something quite simple. To understand this, consider some
arbitrary but specific point in the output domain with coordinates ðx; yÞ. We wish to know
Figure 2.3 Demonstrating the action of a linear operator S. Applying the operator (a blur in this
case) to the inputs and then linearly combining the results produces the same result as linearly
combining them and then applying the operator
24 CH 2 FORMATION
gðx; yÞ, the output response at that point. The linear superposition integral can be
understood by breaking it down into three steps:
(1) Take the value of the input function f at some point in the input domain ðx0
; y0
Þ and
multiply it by some weight h, with h determining the amount by which the input flux
at this particular point contributes to the output point.
(2) Repeat this for each and every valid point in the input domain multiplying by the
appropriate weight each time.
(3) Sum (i.e. integrate) all such contributions to give the response gðx; yÞ.
Clearly, it is the weighting function h which determines the basic behaviour of the imaging
system. This function tells us the specific contribution made by each infinitesimal point in
the input domain to each infinitesimal point in the resulting output domain. In the most
general case, it is a function of four variables, since we must allow for the contribution of
a given point ðx0
; y0
Þ in the input space to a particular point ðx; yÞ in the output space to
depend on the exact location of both points. In the context of imaging, the weighting
function h is referred to as the point-spread function (PSF). The reason for this name will be
demonstrated shortly. First, however, we introduce an important concept in imaging: the
(Dirac) delta or impulse function.
2.2.4 The Dirac delta or impulse function
In image processing, the delta or impulse function is used to represent mathematically a
bright intensity source which occupies a very small (infinitesimal) region in space. It can be
Figure 2.4 The linear superposition principle. Each point in the output is given by a weighted sum
(integral) of all input points. The weight function is called the point-spread function and specifies the
contribution of each and every input point to each and every output point
2.2 THE MATHEMATICS OF IMAGE FORMATION 25
modelled in a number of ways,1
but arguably the simplest is to consider it as the limiting
form of a scaled rectangle function as the width of the rectangle tends to zero. The 1-D
rectangle function is defined as
rect

x
a

¼ 1 jxj  a=2
¼ 0 otherwise
ð2:4Þ
Accordingly, the 1-D and 2-D delta function can be defined as
dðxÞ ¼ lim
a ! 0
1
a
rect

x
a

in 1-D
dðx; yÞ ¼ lim
a ! 0
1
a2
rect

x
a

rect

y
a

in 2-D
ð2:5Þ
In Figure 2.5 we show the behaviour of the scaled rectangle function as a ! 0. We
see that:
As a ! 0 the support (the nonzero region) of the function tends to a vanishingly small
region either side of x ¼ 0.
As a ! 0 the height of the function tends to infinity but the total area under the function
remains equal to one.
dðxÞ is thus a function which is zero everywhere except at x ¼ 0 precisely. At this point,
the function tends to a value of infinity but retains a finite (unit area) under the function.
a
a
a
a
1 a
1
a
x
δ (x)
δ (x) dx = 1
δ (x) = lim
∞
∞
−∞
冕
1
a
1
a
x
⎛
⎛ ⎛
⎛
rect
Figure 2.5 The Dirac delta or impulse function can be modelled as the limiting form of a scaled
rectanglefunction asits width tends to zero. Notethat the area under the delta function is equalto unity
1
An alternative is the limiting form of a Gaussian function as the standard deviation s ! 0.
26 CH 2 FORMATION
Thus:
dðxÞ ¼ ¥ x ¼ 0
¼ 0 x 6¼ 0
ð2:6Þ
ð
¥
¥
dðxÞ dx ¼ 1 ð2:7Þ
and it follows that a shifted delta function corresponding to an infinitesimal point located at
x ¼ x0 is defined in exactly the same way, as
dðxx0Þ ¼ ¥ x ¼ x0
¼ 0 x 6¼ x0
ð2:8Þ
These results extend naturally to two dimensions and more:
dðx; yÞ ¼ ¥ x ¼ 0; y ¼ 0
¼ 0 otherwise
ð2:9Þ
ð
¥
¥
ð
¥
¥
dðx; yÞ dx dy ¼ 1 ð2:10Þ
However, the most important property of the delta function is defined by its action under
an integral sign, i.e. its so-called sifting property. The sifting theorem states that
ð
¥
¥
f ðxÞdðxx0Þ dx ¼ f ðx0Þ 1-D case
ð
¥
¥
ð
¥
¥
f ðx; yÞdðxx0; yy0Þ dx dy ¼ f ðx0; y0Þ 2-D case
ð2:11Þ
This means that, whenever the delta function appears inside an integral, the result is equal to
the remaining part of the integrand evaluated at those precise coordinates for which the
delta function is nonzero.
In summary, the delta function is formally defined by its three properties of singularity
(Equation (2.6)), unit area (Equation (2.10)) and the sifting property (Equation (2.11)).
Delta functions are widely used in optics and image processing as idealized representa-
tions of point and line sources (or apertures):
f ðx; yÞ ¼ dðxx0; yy0Þ ðpoint source located at x0; y0Þ
f ðx; yÞ ¼ dðxx0Þ ðvertical line source located on the line x ¼ x0Þ
f ðx; yÞ ¼ dðyy0Þ ðhorizontal line source located on the line y ¼ y0Þ
f ðx; yÞ ¼ dðax þ by þ cÞ ðsource located on the straight line ax þ by þ cÞ
ð2:12Þ
2.2 THE MATHEMATICS OF IMAGE FORMATION 27
2.2.5 The point-spread function
The point-spread function of a system is defined as the response of the system to an input
distribution consisting of a very small intensity point. In the limit that the point becomes
infinitesimal in size, we can represent the input function as a Dirac delta function
f ðx0
; y0
Þ ¼ dðx0
x0; y0
y0Þ. For a linear system, we can substitute this into the linear
superposition integral, Equation (2.3), to give
gðx; yÞ ¼
Z Z
dðx0
x0; y0
y0Þhðx; y; x0
; y0
Þ dx0
dy0
ð2:13Þ
By applying the sifting theorem of Equation (2.11) this gives a response gðx; yÞ to the point-
like input as
gðx; yÞ ¼ hðx; y; x0; y0Þ ð2:14Þ
In other words, the response to the point-like input (sometimes termed the impulse
response) is precisely equal to h. However, in the context of imaging, the weighting function
in the superposition integral hðx; y; x0
; y0
Þ is termed the point spread function or PSF
because it measures the spread in output intensity response due to an infinitesimal (i.e.
infinitely sharp) input point.
Why, then, is the PSF an important measure? Consider for a moment that any input
distribution may be considered to consist of a very large ( ! ¥) collection of very small
( ! infinitesimal) points of varying intensity. The PSF tells us what each of these points will
look like in the output; so, through the linearity of the system, the output is given by the sum
of the PSF responses. It is thus apparent that the PSF of such a linear imaging system (in the
absence of noise) completely describes its imaging properties and, therefore, is of primary
importance in specifying the behaviour of the system.
It also follows from what we have said so far that an ideal imaging system would possess
a PSF that exactly equalled the Dirac delta function for all combinations of the input and
output coordinates (i.e. all valid combinations of the coordinates ðx; y; x0
; y0
Þ). Such a
system would map each infinitesimal point in the input distribution to a corresponding
infinitesimal point in the output distribution. There would be no blurring or loss of detail
and the image would be ‘perfect’. Actually, the fundamental physics of electromagnetic
diffraction dictates that such an ideal system can never be achieved in practice, but it
nonetheless remains a useful theoretical concept. By extension then, a good or ‘sharp’
imaging system will generally possess a narrow PSF, whereas a poor imaging system will have
a broad PSF, which has the effect of considerably overlapping the output responses to
neighbouring points in the input. This idea is illustrated in Figure 2.6, in which a group
of points is successively imaged by systems with increasingly poor (i.e. broader) PSFs.
Figure 2.6 The effect of the system PSF. As the PSF becomes increasingly broad, points in the
original input distribution become broader and overlap
28 CH 2 FORMATION
2.2.6 Linear shift-invariant systems and the convolution integral
So far in our presentation, we have assumed that the system PSF may depend on the absolute
locations of the two points in the input and output domains. In other words, by writing
the PSF as a function of four variables in Equation (2.3), we have explicitly allowed for the
possibility that the response at, let us say, point x1; y1 in the output domain due to a point
x0
1; y0
1 in the input domain may be quite different from that at some other output point x2; y2.
If this were the case in practice for all pairs of input and output points, then specification of
the system PSF would be a very cumbersome business. As an example, consider discretizing
both the input and output domains into even a modest number of pixels such as 128  128.
Since every pixel in the input can in principle contribute to every pixel in the output in a
different way, we would then require 1284
 268.4 million values to fully specify the system
behaviour.
Fortunately, most imaging systems (at least to a very good approximation) possess a
property called shift invariance or isoplanatism. A shift-invariant system is characterized
by a PSF that depends only on the difference between the coordinates in the input and
output domains, not on their absolute values. Thus, a shift-invariant PSF in a 2-D imaging
system has a functional form which makes it dependent not on four variables, but on two
variables only:
hðx; y; x0
; y0
Þ ¼ hðx
00
; y
00
Þ ¼ hðxx0
; yy0
Þ ð2:15Þ
Shift invariance has a simple physical interpretation. Consider a source point in the input
domain at coordinates x0
; y0
. If we move this source point to different locations in the input
domain, changing the values of the coordinates x0
; y0
, the corresponding response (i.e. its
shape/functional form) in the output domain will remain the same but will simply be
correspondingly translated in the output domain. In other words, shift the input and the
corresponding output just shifts too. Figure 2.72
is a simulation of a photon-limited system
in which photons in the input domain are randomly emitted and imaged by the linear shift-
invariant system. This shows clearly how the image is built as the weighted superposition of
shift-invariant responses to an increasing number of point-like inputs.
When we have a shift-invariant system, the linear superposition integral Equation (2.3)
reduces to a simpler and very important form – a convolution integral:
gðx; yÞ ¼
ð
¥
¥
ð
¥
¥
f ðx0
; y0
Þhðxx0
; yy0
Þ dx0
dy0
ð2:16Þ
Note that the infinite limits are used to indicate that the integration is to take place over all
values for which the product of the functions is nonzero. The output gðx; yÞ is said to be
given by the convolution of the input f ðx; yÞ with the PSF hðx; yÞ. Note that the
corresponding form for convolution of 1-D functions follows naturally:
gðxÞ ¼
ð
¥
¥
f ðx0
Þhðxx0
Þ dx0
ð2:17Þ
2
The Matlab code which produced Figure 2.7 is available at http://www.fundipbook.com/materials/.
2.2 THE MATHEMATICS OF IMAGE FORMATION 29
Convolution integrals are so important and common that they are often written in an
abbreviated form:
gðx; yÞ ¼ f ðx; yÞ   hðx; yÞ ð2-DÞ
gðxÞ ¼ f ðxÞ  hðxÞ ð1-DÞ
ð2:18Þ
where the asterisks denote the operation of convolving the input function f with the
system PSF h. In general, the function h in the convolution integrals above is called the
kernel.
2.2.7 Convolution: its importance and meaning
It would be hard to overstate the importance of convolution in imaging. There are two main
reasons:
(1) A very large number of image formation processes (and, in fact, measurement
procedures in general) are well described by the process of convolution. In fact, if
a system is both linear and shift invariant, then image formation is necessarily
described by convolution.
(2) The convolution theorem (which we will discuss shortly) enables us to visualize and
understand the convolution process in the spatial frequency domain. This equiva-
lent frequency-domain formulation provides a very powerful mathematical frame-
work to deepen understanding of both image formation and processing.
This framework will be developed in Chapter 5 and also forms a major part of
Chapter 6.
Figure 2.7 Each image in the top row shows arbitrary points in the input domain (increasing
in number from left to right) whilst the images in the bottom row show the response of a LSI
system to the corresponding input. The final image at the bottom right consists of a weighted
superposition of responses to the input points, each of which has a similar mathematical shape or
form
30 CH 2 FORMATION
First, let us try to understand the mechanism of the convolution process. A convolution
integral is a type of ‘overlap’ integral, and Figure 2.8 gives a graphical representation of how
convolutions occur and are calculated. Basically, a flipped version of one of the functions is
systematically displaced and the integral of their product (the overlap area) is calculated at
each shift position. All shift coordinates for which the overlap area is nonzero define the
range of the convolution.
We might well still ask, but why then is the physical process of forming an image so often
described by convolution? This is perhaps best understood through a simple example (see
Figure 2.9a–c). Gamma rays are too energetic to be focused, so that the very earliest gamma
ray detectors used in diagnostic radionuclide imaging consisted of a gamma-ray-sensitive
scintillation crystal encapsulated by a thick lead collimator with a finite-size aperture to allow
normally incident gamma photons to strike and be absorbed in the crystal. The scan was
acquired by raster-scanning with uniform speed over the patient; in this way, the derived
signal is thus proportional to the gamma activity emanating from that region of the body
lying beneath the aperture. Note that a finite-size aperture is absolutely necessary because
reducing the aperture size to an infinitesimal size would permit a vanishingly small fraction
of emitted photons to actually reach the detector, which is clearly useless for diagnostic
purposes.
Let us first remind ourselves that, in general, the linear superposition integral allows for
the possibility that every point in the input domain f ðx0
Þ may in principle contribute to the
detector response at a chosen point x and does this through the PSF hðx; x0
Þ; thus, we
have quite generally that gðxÞ ¼
Ð
f ðx0
Þhðx; x0
Þ dx0
. Consider then Figure 2.9a, where for
Figure 2.8 The calculation of a 1-D convolution integral
2.2 THE MATHEMATICS OF IMAGE FORMATION 31
Detector
(delta-like)
Scanning pinhole
(delta-like)
(a)
1-D intensity profile
δ (x′) f (x′)
x′
x
g(x)
g(x) = f (x′) h (x ,x′)dx′ = f (x′) δ (x –x′)dx′ = f (x)
冕 冕
Detector
(delta-like)
Scanning pinhole
(finite aperture)
(b)
1-D intensity profile
h (x′) f (x′)
x′
x
g(x)
g(x) = f (x′) h (x ,x′)dx′ = f (x′) h (x –x′)dx′
冕 冕
Detector
(finite size)
Scanning pinhole
(finite aperture)
(c)
1-D intensity profile
h (x′)
I (x) hd (x′) f (x′)
x′
x
I (x) = g (x′) hd (x ,x′)dx′
I (x) = f (x′) *h (x ,)*hd (x)
g (x) = f (x′) δ (x –x′)dx′
冕 冕
where
Figure 2.9 (a) A delta like detector views a source intensity profile through a delta-like scanning
pinhole. The resulting image is a convolution of the source with the pinhole PSF. In principle, this
replicates the source profile so that gðxÞ ¼ f ðxÞ but this idealized response can never describe a real
system. (b) Here, a delta like detector views a source intensity profile through a finite-size scanning
pinhole. The resulting image is a convolution of the source with the pinhole PSF. All real systems
exhibit such finite aperture effects. (c) A finite-size detector viewing a source intensity profile through
a finite scanning pinhole. The resulting image is a convolution of the source intensity with both the
pinhole and detector PSFs. In general, if N LSI elements are involved in the image formation process,
the resulting image is described by convolving the source with each corresponding PSF
32 CH 2 FORMATION
simplicity, we depict a 1-D detector and a 1-D intensity source. The idealized pinhole
aperture may be approximated by a delta function dðx0
Þ. It is readily apparent that, if the
detector were kept stationary but the pinhole aperture scanned along the x0
axis, we
would only get a nonzero detector response gðxÞ at the detector when the shift
coordinate x ¼ x0
. This situation is thus described by the linear superposition
gðxÞ ¼
Ð
f ðx0
Þdðxx0
Þ dx0
.3
If we now consider a finite pinhole aperture, as in Figure 2.9b, it is clear that many points
in the input domain will now contribute to the detector response gðxÞ but some will not.
In fact, it is clear that only those points in the input domain for which the difference xx0
lies
below a certain threshold can contribute. Note that the PSF of this scanning aperture is
determined by pure geometry and the detector response is thus independent of the absolute
position x0
of the aperture – the dependence on x0
comes only as a result of how the input
f ðx0
Þ changes.
Finally, consider Figure 2.9c. Here, we depict a finite detector aperture as well as a
finite scanning aperture, and this results in a more complicated situation. However, this
situation is simply described by an additional further convolution such that the actual
recorded intensity at the finite detector is now given by IðxÞ ¼
Ð
gðx0
Þhdðxx0
Þ dx0
,
where gðx0
Þ is the intensity at some point on the detector and hdðx0
Þ is the detector
response (PSF). The way to understand this situation is depicted in Figure 2.10.
Essentially, we break it down into two parts, first calculating the resulting intensity
Contribution dI to the total intensity over
the detector at point x′ is the product
of the incident intensity g and the response
at that point h
The total recorded intensity is the sum of
all such contributions over the detector-
Detector
x′
x
hd (x′)
hd (x – x′)
I (x) = 冕dI = 冕g(x′) h (x – x′) dx′
dI = g (x′) h (x –x′)
–∞
∞
Figure 2.10 The response of a finite detector with response function hdðxÞ to an incident intensity
field gðxÞ is given by their convolution. We consider the contribution to the total intensity recorded
by the detector at some ordinate x0
when the detector is displaced by some amount x. This is
dI ¼ gðx0
Þhdðx x0
Þ. By integrating all such contributions over the detector surface we obtain the
convolution integral
3
Strictly, this supposes that the effective sensitive area of the detector is infinitesimal and thus also well
approximated by a delta response this will occur either because it is infinitesimally small or because the scanning
aperture lies very close to it.
2.2 THE MATHEMATICS OF IMAGE FORMATION 33
at a fixed point on the detector and then considering how all such contributions
make up the final recorded intensity. Referring to Figure 2.10, the detector has a response
hdðx0
Þ when referred to the origin. We are interested in the total intensity recorded
by this detector IðxÞ when it is displaced some distance x from the origin. The contribution
to the recorded intensity dI at some precise point with ordinate x0
is given by the
product of the incident intensity at that point gðx0
Þ times the shifted response hdðxx0
Þ –
thus dI ¼ gðx0
Þhdðxx0
Þ. The total recorded intensity at the detector is thus given
by all such contributions dI for which the ordinate x0
lies within the dimensions
of the detector dimension (i.e. for which dI ¼ gðx0
Þhdðxx0
Þ 6¼ 0. Thus, we
obtain IðxÞ ¼
Ð
dI ¼
Ð ¥
¥ gðx0
Þhdðxx0
Þ dx0
.
2.2.8 Multiple convolution: N imaging elements in a linear shift-invariant
system
In Figure 2.9c we effectively have an imaging system in which two aperture functions
describe the imaging properties: hðxÞ and hdðxÞ. Under these circumstances, we have seen
that the recorded intensity IðxÞ is given by successive convolutions of the input f ðxÞ with the
PSF of the scanning aperture hðxÞ and the PSF of the detector hdðxÞ. Symbolically, we denote
this by IðxÞ ¼ f ðxÞ  hðxÞ  hdðxÞ. Provided the assumption of linearity and shift invariance
remains valid, this result extends naturallyto an arbitrary system of Nimaging elements (e.g.
a sequence of lenses in an optical imaging system). Thus, in general, any processing sequence
in which N linear and shift-invariant system elements act upon the input is described by a
sequence of N convolutions of the input with the respective PSFs of the elements. This is
summarized in Figure 2.11.
2.2.9 Digital convolution
In digital image processing, signals are discrete not continuous. Under these conditions,
convolution of two functions is achieved by discretizing the convolution integral. In the
simple 1-D case, this becomes
PSF 1 PSF 2 PSF N
Output
Input
h1 (x) h2 (x) hn (x)
g (x) = f (x)* h1 (x)* h2 (x)...*h2 (x)
g (x)
f (x)
Figure 2.11 The output of an LSI system characterized by N components each having a PSF hiðxÞ is
the repeated convolution of the input with each PSF
34 CH 2 FORMATION
gj ¼
X
i
fihj i ð2:19Þ
where the indices j and i correspond to discrete values of x and x0
respectively.
In two dimensions, the discrete convolution integral may be written as
gkl ¼
X
j
X
i
fijhk i;l j ð2:20Þ
where the indices k and l correspond to x and y and i and j correspond to x0
and y0
. This
equation somewhat belies the simplicity of the mechanism involved. The filter kernel h is
only nonzero when both the shift coordinates k  i and l  j are small enough to lie within
the spatial extent of h (i.e. are nonzero). For this reason, although the image fij has a large
spatial extent, the filter kernel hk i;l j, when it corresponds to a PSF, is typically of much
smaller spatial extent. The convolved or filtered function is thus given by a weighted
combination of all those pixels that lie beneath the filter kernel (see Figure 2.12). A simple
example of 1-D discrete convolution in Matlab
is given in Example 2.1 and some simple
examples of 2-D convolution using Matlab are given in Example 2.2. Note that 2-D
convolution of two functions that are both of large spatial extent is much more computa-
tionally efficient when carried out in the Fourier domain. We will discuss this when we
introduce the convolution theorem later in Chapter 5. Figures 2.13 and 2.14 result from the
code in Examples 2.1 and 2.2.
12
–1 –1 –1
–1 –1 –1
–1
w1 w2 w3
w4 w5 w6
w7 w8 w9
= 8 –1
10
32
40
41
42
12
Image
= (–1x10) + (–1x11) + (–1x8) + (–1x40) + (8x35)
fi = ∑ wkIk (i)
+ (–1x42) + (–1x38) + (–1x36) + (–1x46) = 14
10
40
38
89
39
13
11
35
36
39
43
13
8
42
46
42
45
9
13
40
41
39
38
11
8
36
37
36
37
9
i–j
Figure 2.12 Discrete convolution. The centre pixel of the kernel and the target pixel in the image
are indicated by the dark grey shading. The kernel is ‘placed’ on the image so that the centre and
target pixels match. The filtered value of the target pixel is then given by a linear combination of
the neighbourhood pixels, the specific weights being determined by the kernel values. In this
specific case the target pixel of original value 35 has a filtered value of 14
2.2 THE MATHEMATICS OF IMAGE FORMATION 35
Example 2.2
Matlab code What is happening?
A¼imread('trui.png'); %Read in image
PSF¼ fspecial('gaussian',[5 5],2); %Define Gaussian convolution kernel
h¼fspecial('motion',10,45); %Define motion filter
B¼conv2(PSF,A); %Convolve image with convolution kernel
C¼imfilter(A,h,'replicate'); %Convolve motion PSF using alternative function
D¼conv2(A,A); %Self convolution motion blurred with original
subplot(2,2,1),imshow(A); %Display original image
subplot(2,2,2),imshow(B,[]); %Display filtered image
subplot(2,2,3),imshow(C,[]); %Display filtered image
subplot(2,2,4),imshow(D,[]); %Display convolution image with
itself (autocorrln)
Comments
Matlab functions: conv2, imfilter.
This example illustrates 2 D convolution. The first two examples show convolution of the
image with a Gaussian kernel using two related Matlab functions. The final image shows the
autocorrelation of the image given by the convolution of the function with itself.
Example 2.1
Matlab code What is happening?
f¼ones(64,1); f¼f./sum(f); %Define rectangle signal f and normalize
g¼conv(f,f); g¼g./sum(g); %Convolve f with itself to give g and normalize
h¼conv(g,g); h¼h./sum(h); %Convolve g with itself to give h and normalize
j¼conv(h,h); j¼j./sum(j); %Convolve h with itself to give j and normalize
subplot(2,2,1),plot(f,'k '); axis square;
axis off;
subplot(2,2,2),plot(g,‘k ’); axis square;
axis off;
subplot(2,2,3),plot(h,‘k ’); axis square;
axis off;
subplot(2,2,4),plot(j,‘k ’); axis square;
axis off;
Comments
Matlab functions: conv.
This example illustrates the repeated convolution of a 1 D uniform signal with itself. The
resulting signal quickly approaches the form of the normal distribution, illustrating the central
limit theorem of statistics.
36 CH 2 FORMATION
2.3 The engineering of image formation
From our mathematical consideration of the image formation, we now briefly consider the
engineering aspects of this process. It is not possible to consider every eventuality in this
instance, but we instead limit ourselves to the most common and, hence, practical imaging
scenarios.
f (x) g (x) = f (x)* f (x)
j (x) = g (x)*h (x)
h(x) = g (x)*g (x)
Figure 2.13 Repeated convolution of a 1-D rectangle signal. The output rapidly approaches the form
of the normal distribution, illustrating the central limit theorem of statistics
Figure 2.14 Top left: original image; top right: after convolution with Gaussian kernel; bottom left:
after convolution with Gaussian kernel; bottom right: convolution of the image with itself
2.3 THE ENGINEERING OF IMAGE FORMATION 37
2.3.1 The camera
In general, let us consider our imaging device to be a camera. A camera image of a
conventional scene is essentially a projection of the 3-D world (i.e. the scene) to a 2-D
representation (i.e. the image). The manner in which this 3-D to 2-D projection occurs is
central to our ability to perform effective analysis on digital images.
If we assume an object/scene is illuminated by a light source (possibly multiple
sources), then some of the light will be reflected towards the camera and captured as a
digital image. Assuming we have a conventional camera, the light reflected into the lens is
imaged onto the camera image plane based on the camera projection model. The camera
projection model transforms 3-D world coordinates ðX; Y; ZÞ to 2-D image coordinates
ðx; yÞ on the image plane. The spatial quantization of the image plane projection into a
discretized grid of pixels in turn transforms the 2-D image coordinate on the image plane
to a pixel position ðc; rÞ. The majority of scene images we deal with will be captured using
a perspective camera projection.
Perspective projection: In general the perspective projection (Figure 2.15, right) can be
stated as follows:
x ¼ f
X
Z
y ¼ f
Y
Z
ð2:21Þ
A position ðX; Y; ZÞ in the scene (depth Z) is imaged at position ðx; yÞ on the image plane
determined by the focal length of the camera f (lens to image plane distance). The
perspective projection has the following properties (illustrated in Figure 2.16):
. Foreshortening The size of objects imaged is dependent on their distance from the
viewer. Thus, objects farther away from the viewer appear smaller in the image.
. Convergence Lines that are parallel in the scene appear to converge in the resulting
image. This is known as perspective distortion, with the point(s) at which parallel lines
meet termed the vanishing point(s) of the scene.
Scene Co-ordinates
Scene Co-ordinates
Image Co-ordinates
Image Co-ordinates
Perspective
Projection Model
Parallel
Projection Model
Z
X
Y
y
Z
f
Y
X
Z
x
y
x
Figure 2.15 Camera projection models: perspective (left) and parallel/affine (right)
38 CH 2 FORMATION
Tobemoreprecisethisisthepin-holeperspectiveprojectionmodel,asweassumeallthelight
rays pass through a single point and, hence, the scene is inverted (horizontally and vertically)
on the image plane (Figure 2.15, left). Realistically, we deploy a lens, which further
complicates matters by introducing lens distortion (affecting f), but this optics-related
topic is beyond the scope of this text. With a lens, the scene is still imaged upside down (and
back to front), but this is generally dealt with by the camera and should be ignored for all
applied purposes. It should be noted that the perspective projection is not easily invertible
from an image alone – i.e. given 2-D image position ðx; yÞ and camera focal length f it is not
possible to recover ðX; Y; ZÞ. However, given knowledge of ðX; YÞ in the scene (measured
relative to the camera position), the recovery of position depth Z may become possible
(subject to noise and distortion). Accurate ðX; YÞ positions, relative to the exact camera
position, are, however, difficult to determine and rarely recorded at time of image capture.
Orthographic projection: An alternative camera projection model to the perspective
projection is the orthographic (or parallel) projection. This is used by some specialist
imaging instruments; for instance, a flat-bed scanner produces an orthographic projection
of a scanned document, a medical scanner produces an orthographic projection of the
human body. The orthographic projection is simply denoted as
x ¼ X y ¼ Y
The orthographic projection is an affine transformation such that relative geometric
relationships are maintained, as the scene to image plane projection is parallel. As such, the
image features are not reversed (Figure 2.15, right), but notably all information relating to
scene depth is lost. In an orthographic projection, size is independent of the distance from
the viewer and parallel lines are preserved. The projection may have a scaling factor m such
that x ¼ mX and y ¼ mY, but this relates to regular image zooming or reduction and
maintains these properties. Images captured over a close range (i.e. short focal length,
macro-scale photography) or of a planar target can often be assumed to have an
orthographic camera projection because of the negligible effects of the perspective projec-
tion over this range.
In addition to the projection model, the camera has a number of other characteristics
that determine the final image formed from the scene. Notably any camera is of fixed spatial
Convergence of
parallel lines
Foreshortening
Vanishing Point
Figure 2.16 Effects of the perspective projection model on scene geometry in the image
2.3 THE ENGINEERING OF IMAGE FORMATION 39
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf

More Related Content

Similar to Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf

docmentation with rules
docmentation with rulesdocmentation with rules
docmentation with rulesKathi Reddy
 
An Edge Detection Method for Hexagonal Images
An Edge Detection Method for Hexagonal ImagesAn Edge Detection Method for Hexagonal Images
An Edge Detection Method for Hexagonal ImagesCSCJournals
 
Artifacts Detection by Extracting Edge Features and Error Block Analysis from...
Artifacts Detection by Extracting Edge Features and Error Block Analysis from...Artifacts Detection by Extracting Edge Features and Error Block Analysis from...
Artifacts Detection by Extracting Edge Features and Error Block Analysis from...Md. Mehedi Hasan
 
Object Tracking with Instance Matching and Online Learning
Object Tracking with Instance Matching and Online LearningObject Tracking with Instance Matching and Online Learning
Object Tracking with Instance Matching and Online LearningJui-Hsin (Larry) Lai
 
Report face recognition : ArganRecogn
Report face recognition :  ArganRecognReport face recognition :  ArganRecogn
Report face recognition : ArganRecognIlyas CHAOUA
 
Lossless Huffman coding image compression implementation in spatial domain by...
Lossless Huffman coding image compression implementation in spatial domain by...Lossless Huffman coding image compression implementation in spatial domain by...
Lossless Huffman coding image compression implementation in spatial domain by...IRJET Journal
 
Smoking and Pregnancy SurveyPlease take this brief survey of w.docx
Smoking and Pregnancy SurveyPlease take this brief survey of w.docxSmoking and Pregnancy SurveyPlease take this brief survey of w.docx
Smoking and Pregnancy SurveyPlease take this brief survey of w.docxpbilly1
 
Super Resolution with OCR Optimization
Super Resolution with OCR OptimizationSuper Resolution with OCR Optimization
Super Resolution with OCR OptimizationniveditJain
 
Multi Image Deblurring using Complementary Sets of Fluttering Patterns by Mul...
Multi Image Deblurring using Complementary Sets of Fluttering Patterns by Mul...Multi Image Deblurring using Complementary Sets of Fluttering Patterns by Mul...
Multi Image Deblurring using Complementary Sets of Fluttering Patterns by Mul...IRJET Journal
 
Image search using similarity measures based on circular sectors
Image search using similarity measures based on circular sectorsImage search using similarity measures based on circular sectors
Image search using similarity measures based on circular sectorscsandit
 
IMAGE SEARCH USING SIMILARITY MEASURES BASED ON CIRCULAR SECTORS
IMAGE SEARCH USING SIMILARITY MEASURES BASED ON CIRCULAR SECTORSIMAGE SEARCH USING SIMILARITY MEASURES BASED ON CIRCULAR SECTORS
IMAGE SEARCH USING SIMILARITY MEASURES BASED ON CIRCULAR SECTORScscpconf
 
BULK IEEE PROJECTS IN MATLAB ,BULK IEEE PROJECTS, IEEE 2015-16 MATLAB PROJEC...
 BULK IEEE PROJECTS IN MATLAB ,BULK IEEE PROJECTS, IEEE 2015-16 MATLAB PROJEC... BULK IEEE PROJECTS IN MATLAB ,BULK IEEE PROJECTS, IEEE 2015-16 MATLAB PROJEC...
BULK IEEE PROJECTS IN MATLAB ,BULK IEEE PROJECTS, IEEE 2015-16 MATLAB PROJEC...Nexgen Technology
 

Similar to Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf (20)

pdf.pdf
pdf.pdfpdf.pdf
pdf.pdf
 
pdf.pdf
pdf.pdfpdf.pdf
pdf.pdf
 
Machine learning
Machine learningMachine learning
Machine learning
 
Thebook
ThebookThebook
Thebook
 
docmentation with rules
docmentation with rulesdocmentation with rules
docmentation with rules
 
An Edge Detection Method for Hexagonal Images
An Edge Detection Method for Hexagonal ImagesAn Edge Detection Method for Hexagonal Images
An Edge Detection Method for Hexagonal Images
 
Bertimas
BertimasBertimas
Bertimas
 
557 480-486
557 480-486557 480-486
557 480-486
 
Artifacts Detection by Extracting Edge Features and Error Block Analysis from...
Artifacts Detection by Extracting Edge Features and Error Block Analysis from...Artifacts Detection by Extracting Edge Features and Error Block Analysis from...
Artifacts Detection by Extracting Edge Features and Error Block Analysis from...
 
Object Tracking with Instance Matching and Online Learning
Object Tracking with Instance Matching and Online LearningObject Tracking with Instance Matching and Online Learning
Object Tracking with Instance Matching and Online Learning
 
poster_silhouette
poster_silhouetteposter_silhouette
poster_silhouette
 
Report face recognition : ArganRecogn
Report face recognition :  ArganRecognReport face recognition :  ArganRecogn
Report face recognition : ArganRecogn
 
Lossless Huffman coding image compression implementation in spatial domain by...
Lossless Huffman coding image compression implementation in spatial domain by...Lossless Huffman coding image compression implementation in spatial domain by...
Lossless Huffman coding image compression implementation in spatial domain by...
 
Smoking and Pregnancy SurveyPlease take this brief survey of w.docx
Smoking and Pregnancy SurveyPlease take this brief survey of w.docxSmoking and Pregnancy SurveyPlease take this brief survey of w.docx
Smoking and Pregnancy SurveyPlease take this brief survey of w.docx
 
337
337337
337
 
Super Resolution with OCR Optimization
Super Resolution with OCR OptimizationSuper Resolution with OCR Optimization
Super Resolution with OCR Optimization
 
Multi Image Deblurring using Complementary Sets of Fluttering Patterns by Mul...
Multi Image Deblurring using Complementary Sets of Fluttering Patterns by Mul...Multi Image Deblurring using Complementary Sets of Fluttering Patterns by Mul...
Multi Image Deblurring using Complementary Sets of Fluttering Patterns by Mul...
 
Image search using similarity measures based on circular sectors
Image search using similarity measures based on circular sectorsImage search using similarity measures based on circular sectors
Image search using similarity measures based on circular sectors
 
IMAGE SEARCH USING SIMILARITY MEASURES BASED ON CIRCULAR SECTORS
IMAGE SEARCH USING SIMILARITY MEASURES BASED ON CIRCULAR SECTORSIMAGE SEARCH USING SIMILARITY MEASURES BASED ON CIRCULAR SECTORS
IMAGE SEARCH USING SIMILARITY MEASURES BASED ON CIRCULAR SECTORS
 
BULK IEEE PROJECTS IN MATLAB ,BULK IEEE PROJECTS, IEEE 2015-16 MATLAB PROJEC...
 BULK IEEE PROJECTS IN MATLAB ,BULK IEEE PROJECTS, IEEE 2015-16 MATLAB PROJEC... BULK IEEE PROJECTS IN MATLAB ,BULK IEEE PROJECTS, IEEE 2015-16 MATLAB PROJEC...
BULK IEEE PROJECTS IN MATLAB ,BULK IEEE PROJECTS, IEEE 2015-16 MATLAB PROJEC...
 

More from nagwaAboElenein

Chapter 1: Computer Vision Introduction.pptx
Chapter 1: Computer Vision Introduction.pptxChapter 1: Computer Vision Introduction.pptx
Chapter 1: Computer Vision Introduction.pptxnagwaAboElenein
 
Chapter 1: Computer Vision Introduction.pptx
Chapter 1: Computer Vision Introduction.pptxChapter 1: Computer Vision Introduction.pptx
Chapter 1: Computer Vision Introduction.pptxnagwaAboElenein
 
security Symmetric Key Cryptography Substitution Cipher, Transposition Cipher.
security Symmetric Key Cryptography Substitution Cipher, Transposition Cipher.security Symmetric Key Cryptography Substitution Cipher, Transposition Cipher.
security Symmetric Key Cryptography Substitution Cipher, Transposition Cipher.nagwaAboElenein
 
研究生学位论文在线提交Electronic thesis online submission(20210527).ppt
研究生学位论文在线提交Electronic thesis online submission(20210527).ppt研究生学位论文在线提交Electronic thesis online submission(20210527).ppt
研究生学位论文在线提交Electronic thesis online submission(20210527).pptnagwaAboElenein
 
security introduction and overview lecture1 .pptx
security introduction and overview lecture1 .pptxsecurity introduction and overview lecture1 .pptx
security introduction and overview lecture1 .pptxnagwaAboElenein
 
Lec_9_ Morphological ImageProcessing .pdf
Lec_9_ Morphological ImageProcessing .pdfLec_9_ Morphological ImageProcessing .pdf
Lec_9_ Morphological ImageProcessing .pdfnagwaAboElenein
 
Lec_8_Image Compression.pdf
Lec_8_Image Compression.pdfLec_8_Image Compression.pdf
Lec_8_Image Compression.pdfnagwaAboElenein
 
Semantic Segmentation.pdf
Semantic Segmentation.pdfSemantic Segmentation.pdf
Semantic Segmentation.pdfnagwaAboElenein
 
Lec_4_Frequency Domain Filtering-I.pdf
Lec_4_Frequency Domain Filtering-I.pdfLec_4_Frequency Domain Filtering-I.pdf
Lec_4_Frequency Domain Filtering-I.pdfnagwaAboElenein
 
Lec_3_Image Enhancement_spatial Domain.pdf
Lec_3_Image Enhancement_spatial Domain.pdfLec_3_Image Enhancement_spatial Domain.pdf
Lec_3_Image Enhancement_spatial Domain.pdfnagwaAboElenein
 
Lec_2_Digital Image Fundamentals.pdf
Lec_2_Digital Image Fundamentals.pdfLec_2_Digital Image Fundamentals.pdf
Lec_2_Digital Image Fundamentals.pdfnagwaAboElenein
 
Image Segmentation Techniques for Remote Sensing Satellite Images.pdf
Image Segmentation Techniques for Remote Sensing Satellite Images.pdfImage Segmentation Techniques for Remote Sensing Satellite Images.pdf
Image Segmentation Techniques for Remote Sensing Satellite Images.pdfnagwaAboElenein
 

More from nagwaAboElenein (17)

Chapter 1: Computer Vision Introduction.pptx
Chapter 1: Computer Vision Introduction.pptxChapter 1: Computer Vision Introduction.pptx
Chapter 1: Computer Vision Introduction.pptx
 
Chapter 1: Computer Vision Introduction.pptx
Chapter 1: Computer Vision Introduction.pptxChapter 1: Computer Vision Introduction.pptx
Chapter 1: Computer Vision Introduction.pptx
 
security Symmetric Key Cryptography Substitution Cipher, Transposition Cipher.
security Symmetric Key Cryptography Substitution Cipher, Transposition Cipher.security Symmetric Key Cryptography Substitution Cipher, Transposition Cipher.
security Symmetric Key Cryptography Substitution Cipher, Transposition Cipher.
 
研究生学位论文在线提交Electronic thesis online submission(20210527).ppt
研究生学位论文在线提交Electronic thesis online submission(20210527).ppt研究生学位论文在线提交Electronic thesis online submission(20210527).ppt
研究生学位论文在线提交Electronic thesis online submission(20210527).ppt
 
security introduction and overview lecture1 .pptx
security introduction and overview lecture1 .pptxsecurity introduction and overview lecture1 .pptx
security introduction and overview lecture1 .pptx
 
brain tumor.pptx
brain tumor.pptxbrain tumor.pptx
brain tumor.pptx
 
Lec_9_ Morphological ImageProcessing .pdf
Lec_9_ Morphological ImageProcessing .pdfLec_9_ Morphological ImageProcessing .pdf
Lec_9_ Morphological ImageProcessing .pdf
 
Lec_8_Image Compression.pdf
Lec_8_Image Compression.pdfLec_8_Image Compression.pdf
Lec_8_Image Compression.pdf
 
Semantic Segmentation.pdf
Semantic Segmentation.pdfSemantic Segmentation.pdf
Semantic Segmentation.pdf
 
lecture1.pptx
lecture1.pptxlecture1.pptx
lecture1.pptx
 
Lec_4_Frequency Domain Filtering-I.pdf
Lec_4_Frequency Domain Filtering-I.pdfLec_4_Frequency Domain Filtering-I.pdf
Lec_4_Frequency Domain Filtering-I.pdf
 
Lec_3_Image Enhancement_spatial Domain.pdf
Lec_3_Image Enhancement_spatial Domain.pdfLec_3_Image Enhancement_spatial Domain.pdf
Lec_3_Image Enhancement_spatial Domain.pdf
 
Lec_2_Digital Image Fundamentals.pdf
Lec_2_Digital Image Fundamentals.pdfLec_2_Digital Image Fundamentals.pdf
Lec_2_Digital Image Fundamentals.pdf
 
Lec_1_Introduction.pdf
Lec_1_Introduction.pdfLec_1_Introduction.pdf
Lec_1_Introduction.pdf
 
Lecture3.pptx
Lecture3.pptxLecture3.pptx
Lecture3.pptx
 
Image Segmentation Techniques for Remote Sensing Satellite Images.pdf
Image Segmentation Techniques for Remote Sensing Satellite Images.pdfImage Segmentation Techniques for Remote Sensing Satellite Images.pdf
Image Segmentation Techniques for Remote Sensing Satellite Images.pdf
 
Lec_1_Introduction.pdf
Lec_1_Introduction.pdfLec_1_Introduction.pdf
Lec_1_Introduction.pdf
 

Recently uploaded

Cultivation of KODO MILLET . made by Ghanshyam pptx
Cultivation of KODO MILLET . made by Ghanshyam pptxCultivation of KODO MILLET . made by Ghanshyam pptx
Cultivation of KODO MILLET . made by Ghanshyam pptxpradhanghanshyam7136
 
Work, Energy and Power for class 10 ICSE Physics
Work, Energy and Power for class 10 ICSE PhysicsWork, Energy and Power for class 10 ICSE Physics
Work, Energy and Power for class 10 ICSE Physicsvishikhakeshava1
 
Formation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksFormation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksSérgio Sacani
 
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptxSOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptxkessiyaTpeter
 
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.aasikanpl
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfmuntazimhurra
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSarthak Sekhar Mondal
 
Analytical Profile of Coleus Forskohlii | Forskolin .pdf
Analytical Profile of Coleus Forskohlii | Forskolin .pdfAnalytical Profile of Coleus Forskohlii | Forskolin .pdf
Analytical Profile of Coleus Forskohlii | Forskolin .pdfSwapnil Therkar
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...RohitNehra6
 
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...jana861314
 
Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Patrick Diehl
 
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.aasikanpl
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bSérgio Sacani
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRDelhi Call girls
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Lokesh Kothari
 
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisDiwakar Mishra
 
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡anilsa9823
 
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxPhysiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxAArockiyaNisha
 

Recently uploaded (20)

Cultivation of KODO MILLET . made by Ghanshyam pptx
Cultivation of KODO MILLET . made by Ghanshyam pptxCultivation of KODO MILLET . made by Ghanshyam pptx
Cultivation of KODO MILLET . made by Ghanshyam pptx
 
Work, Energy and Power for class 10 ICSE Physics
Work, Energy and Power for class 10 ICSE PhysicsWork, Energy and Power for class 10 ICSE Physics
Work, Energy and Power for class 10 ICSE Physics
 
Formation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksFormation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disks
 
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptxSOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
 
CELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdfCELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdf
 
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
 
Engler and Prantl system of classification in plant taxonomy
Engler and Prantl system of classification in plant taxonomyEngler and Prantl system of classification in plant taxonomy
Engler and Prantl system of classification in plant taxonomy
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdf
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
 
Analytical Profile of Coleus Forskohlii | Forskolin .pdf
Analytical Profile of Coleus Forskohlii | Forskolin .pdfAnalytical Profile of Coleus Forskohlii | Forskolin .pdf
Analytical Profile of Coleus Forskohlii | Forskolin .pdf
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...
 
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
 
Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?
 
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
 
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
 
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
 
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxPhysiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
 

Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf

  • 1.
  • 2. Fundamentals of Digital Image Processing A Practical Approach with Examples in Matlab Chris Solomon School of Physical Sciences, University of Kent, Canterbury, UK Toby Breckon School of Engineering, Cranfield University, Bedfordshire, UK
  • 3.
  • 5.
  • 6. Fundamentals of Digital Image Processing A Practical Approach with Examples in Matlab Chris Solomon School of Physical Sciences, University of Kent, Canterbury, UK Toby Breckon School of Engineering, Cranfield University, Bedfordshire, UK
  • 7. This edition first published 2011, Ó 2011 by John Wiley & Sons, Ltd Wiley Blackwell is an imprint of John Wiley & Sons, formed by the merger of Wiley’s global Scientific, Technical and Medical business with Blackwell Publishing. Registered office: John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex, PO19 8SQ, UK Editorial Offices: 9600 Garsington Road, Oxford, OX4 2DQ, UK 111 River Street, Hoboken, NJ 07030 5774, USA For details of our global editorial offices, for customer services and for information about how to apply for permission to reuse the copyright material in this book please see our website at www.wiley.com/wiley blackwell The right of the author to be identified as the author of this work has been asserted in accordance with the Copyright, Designs and Patents Act 1988. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, except as permitted by the UK Copyright, Designs and Patents Act 1988, without the prior permission of the publisher. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. Designations used by companies to distinguish their products are often claimed as trademarks. All brand names and product names used in this book are trade names, service marks, trademarks or registered trademarks of their respective owners. The publisher is not associated with any product or vendor mentioned in this book. This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. It is sold on the understanding that the publisher is not engaged in rendering professional services. If professional advice or other expert assistance is required, the services of a competent professional should be sought. MATLABÒ is a trademark of TheMathWorks,Inc. and is used with permission.The MathWorks does notwarrant the accuracy of the text or exercises in this book. This book’s use or discussion of MATLABÒ software or related products does not constitute endorsement or sponsorship by The MathWorks of a particular pedagogical approach or particular use of the MATLABÒ software. Library of Congress Cataloguing in Publication Data Solomon, Chris and Breckon, Toby Fundamentals of digital image processing : a practical approach with examples in Matlab / Chris Solomon and Toby Breckon p. cm. Includes index. Summary:“Fundamentals of DigitalImageProcessingis an introductory textonthescience ofimage processing and employs the Matlab programming language to illustrate some of the elementary, key concepts in modern image processing and pattern recognition drawing on specific examples from within science, medicine and electronics” Provided by publisher. ISBN 978 0 470 84472 4 (hardback) ISBN 978 0 470 84473 1 (pbk.) 1. Image processing Digital techniques. 2. Matlab. I. Breckon, Toby. II. Title. TA1637.S65154 2010 621.36’7 dc22 2010025730 This book is published in the following electronic formats: eBook 9780470689783; Wiley Online Library 9780470689776 A catalogue record for this book is available from the British Library. Set in 10/12.5 pt Minion by Thomson Digital, Noida, India 1 2011
  • 8. Contents Preface xi Using the book website xv 1 Representation 1 1.1 What is an image? 1 1.1.1 Image layout 1 1.1.2 Image colour 2 1.2 Resolution and quantization 3 1.2.1 Bit-plane splicing 4 1.3 Image formats 5 1.3.1 Image data types 6 1.3.2 Image compression 7 1.4 Colour spaces 9 1.4.1 RGB 10 1.4.1.1 RGB to grey-scale image conversion 11 1.4.2 Perceptual colour space 12 1.5 Images in Matlab 14 1.5.1 Reading, writing and querying images 14 1.5.2 Basic display of images 15 1.5.3 Accessing pixel values 16 1.5.4 Converting image types 17 Exercises 18 2 Formation 21 2.1 How is an image formed? 21 2.2 The mathematics of image formation 22 2.2.1 Introduction 22 2.2.2 Linear imaging systems 23 2.2.3 Linear superposition integral 24 2.2.4 The Dirac delta or impulse function 25 2.2.5 The point-spread function 28
  • 9. 2.2.6 Linear shift-invariant systems and the convolution integral 29 2.2.7 Convolution: its importance and meaning 30 2.2.8 Multiple convolution: N imaging elements in a linear shift-invariant system 34 2.2.9 Digital convolution 34 2.3 The engineering of image formation 37 2.3.1 The camera 38 2.3.2 The digitization process 40 2.3.2.1 Quantization 40 2.3.2.2 Digitization hardware 42 2.3.2.3 Resolution versus performance 43 2.3.3 Noise 44 Exercises 46 3 Pixels 49 3.1 What is a pixel? 49 3.2 Operations upon pixels 50 3.2.1 Arithmetic operations on images 51 3.2.1.1 Image addition and subtraction 51 3.2.1.2 Multiplication and division 53 3.2.2 Logical operations on images 54 3.2.3 Thresholding 55 3.3 Point-based operations on images 57 3.3.1 Logarithmic transform 57 3.3.2 Exponential transform 59 3.3.3 Power-law (gamma) transform 61 3.3.3.1 Application: gamma correction 62 3.4 Pixel distributions: histograms 63 3.4.1 Histograms for threshold selection 65 3.4.2 Adaptive thresholding 66 3.4.3 Contrast stretching 67 3.4.4 Histogram equalization 69 3.4.4.1 Histogram equalization theory 69 3.4.4.2 Histogram equalization theory: discrete case 70 3.4.4.3 Histogram equalization in practice 71 3.4.5 Histogram matching 73 3.4.5.1 Histogram-matching theory 73 3.4.5.2 Histogram-matching theory: discrete case 74 3.4.5.3 Histogram matching in practice 75 3.4.6 Adaptive histogram equalization 76 3.4.7 Histogram operations on colour images 79 Exercises 81 vi CONTENTS
  • 10. 4 Enhancement 85 4.1 Why perform enhancement? 85 4.1.1 Enhancement via image filtering 85 4.2 Pixel neighbourhoods 86 4.3 Filter kernels and the mechanics of linear filtering 87 4.3.1 Nonlinear spatial filtering 90 4.4 Filtering for noise removal 90 4.4.1 Mean filtering 91 4.4.2 Median filtering 92 4.4.3 Rank filtering 94 4.4.4 Gaussian filtering 95 4.5 Filtering for edge detection 97 4.5.1 Derivative filters for discontinuities 97 4.5.2 First-order edge detection 99 4.5.2.1 Linearly separable filtering 101 4.5.3 Second-order edge detection 102 4.5.3.1 Laplacian edge detection 102 4.5.3.2 Laplacian of Gaussian 103 4.5.3.3 Zero-crossing detector 104 4.6 Edge enhancement 105 4.6.1 Laplacian edge sharpening 105 4.6.2 The unsharp mask filter 107 Exercises 109 5 Fourier transforms and frequency-domain processing 113 5.1 Frequency space: a friendly introduction 113 5.2 Frequency space: the fundamental idea 114 5.2.1 The Fourier series 115 5.3 Calculation of the Fourier spectrum 118 5.4 Complex Fourier series 118 5.5 The 1-D Fourier transform 119 5.6 The inverse Fourier transform and reciprocity 121 5.7 The 2-D Fourier transform 123 5.8 Understanding the Fourier transform: frequency-space filtering 126 5.9 Linear systems and Fourier transforms 129 5.10 The convolution theorem 129 5.11 The optical transfer function 131 5.12 Digital Fourier transforms: the discrete fast Fourier transform 134 5.13 Sampled data: the discrete Fourier transform 135 5.14 The centred discrete Fourier transform 136 6 Image restoration 141 6.1 Imaging models 141 6.2 Nature of the point-spread function and noise 142 CONTENTS vii
  • 11. 6.3 Restoration by the inverse Fourier filter 143 6.4 The Wiener–Helstrom Filter 146 6.5 Origin of the Wiener–Helstrom filter 147 6.6 Acceptable solutions to the imaging equation 151 6.7 Constrained deconvolution 151 6.8 Estimating an unknown point-spread function or optical transfer function 154 6.9 Blind deconvolution 156 6.10 Iterative deconvolution and the Lucy–Richardson algorithm 158 6.11 Matrix formulation of image restoration 161 6.12 The standard least-squares solution 162 6.13 Constrained least-squares restoration 163 6.14 Stochastic input distributions and Bayesian estimators 165 6.15 The generalized Gauss–Markov estimator 165 7 Geometry 169 7.1 The description of shape 169 7.2 Shape-preserving transformations 170 7.3 Shape transformation and homogeneous coordinates 171 7.4 The general 2-D affine transformation 173 7.5 Affine transformation in homogeneous coordinates 174 7.6 The Procrustes transformation 175 7.7 Procrustes alignment 176 7.8 The projective transform 180 7.9 Nonlinear transformations 184 7.10 Warping: the spatial transformation of an image 186 7.11 Overdetermined spatial transformations 189 7.12 The piecewise warp 191 7.13 The piecewise affine warp 191 7.14 Warping: forward and reverse mapping 194 8 Morphological processing 197 8.1 Introduction 197 8.2 Binary images: foreground, background and connectedness 197 8.3 Structuring elements and neighbourhoods 198 8.4 Dilation and erosion 200 8.5 Dilation, erosion and structuring elements within Matlab 201 8.6 Structuring element decomposition and Matlab 202 8.7 Effects and uses of erosion and dilation 204 8.7.1 Application of erosion to particle sizing 207 8.8 Morphological opening and closing 209 8.8.1 The rolling-ball analogy 210 8.9 Boundary extraction 212 8.10 Extracting connected components 213 viii CONTENTS
  • 12. 8.11 Region filling 215 8.12 The hit-or-miss transformation 216 8.12.1 Generalization of hit-or-miss 219 8.13 Relaxing constraints in hit-or-miss: ‘don’t care’ pixels 220 8.13.1 Morphological thinning 222 8.14 Skeletonization 222 8.15 Opening by reconstruction 224 8.16 Grey-scale erosion and dilation 227 8.17 Grey-scale structuring elements: general case 227 8.18 Grey-scale erosion and dilation with flat structuring elements 228 8.19 Grey-scale opening and closing 229 8.20 The top-hat transformation 230 8.21 Summary 231 Exercises 233 9 Features 235 9.1 Landmarks and shape vectors 235 9.2 Single-parameter shape descriptors 237 9.3 Signatures and the radial Fourier expansion 239 9.4 Statistical moments as region descriptors 243 9.5 Texture features based on statistical measures 246 9.6 Principal component analysis 247 9.7 Principal component analysis: an illustrative example 247 9.8 Theory of principal component analysis: version 1 250 9.9 Theory of principal component analysis: version 2 251 9.10 Principal axes and principal components 253 9.11 Summary of properties of principal component analysis 253 9.12 Dimensionality reduction: the purpose of principal component analysis 256 9.13 Principal components analysis on an ensemble of digital images 257 9.14 Representation of out-of-sample examples using principal component analysis 257 9.15 Key example: eigenfaces and the human face 259 10 Image Segmentation 263 10.1 Image segmentation 263 10.2 Use of image properties and features in segmentation 263 10.3 Intensity thresholding 265 10.3.1 Problems with global thresholding 266 10.4 Region growing and region splitting 267 10.5 Split-and-merge algorithm 267 10.6 The challenge of edge detection 270 10.7 The Laplacian of Gaussian and difference of Gaussians filters 270 10.8 The Canny edge detector 271 CONTENTS ix
  • 13. 10.9 Interest operators 274 10.10 Watershed segmentation 279 10.11 Segmentation functions 280 10.12 Image segmentation with Markov random fields 286 10.12.1 Parameter estimation 288 10.12.2 Neighbourhood weighting parameter un 289 10.12.3 Minimizing U(x | y): the iterated conditional modes algorithm 290 11 Classification 291 11.1 The purpose of automated classification 291 11.2 Supervised and unsupervised classification 292 11.3 Classification: a simple example 292 11.4 Design of classification systems 294 11.5 Simple classifiers: prototypes and minimum distance criteria 296 11.6 Linear discriminant functions 297 11.7 Linear discriminant functions in N dimensions 301 11.8 Extension of the minimum distance classifier and the Mahalanobis distance 302 11.9 Bayesian classification: definitions 303 11.10 The Bayes decision rule 304 11.11 The multivariate normal density 306 11.12 Bayesian classifiers for multivariate normal distributions 307 11.12.1 The Fisher linear discriminant 310 11.12.2 Risk and cost functions 311 11.13 Ensemble classifiers 312 11.13.1 Combining weak classifiers: the AdaBoost method 313 11.14 Unsupervised learning: k-means clustering 313 Further reading 317 Index 319 x CONTENTS
  • 14. Preface Scope of this book This is an introductory text on the science (and art) of image processing. The book also employs the Matlab programming language and toolboxes to illuminate and consolidate some of the elementary but key concepts in modern image processing and pattern recognition. The authors are firm believers in the old adage, “Hear and forget. . ., See and remember. . ., Do and know”. For most of us, it is through good examples and gently guided experimenta- tion that we really learn. Accordingly, the book has a large number of carefully chosen examples, graded exercises and computer experiments designed to help the reader get a real grasp of the material. All the program code (.m files) used in the book, corresponding to the examples and exercises, are made available to the reader/course instructor and may be downloaded from the book’s dedicated web site – www.fundipbook.com. Who is this book for? For undergraduate and graduate students in the technical disciplines, for technical professionals seeking a direct introduction to the field of image processing and for instructors looking to provide a hands-on, structured course. This book intentionally starts with simple material but we also hope that relative experts will nonetheless find some interesting and useful material in the latter parts. Aims What then are the specific aims of this book ? Two of the principal aims are – . To introduce the reader to some of the key concepts and techniques of modern image processing. . To provide a framework within which these concepts and techniques can be understood by a series of examples, exercises and computer experiments.
  • 15. These are, perhaps, aims which one might reasonably expect from any book on a technical subject. However, we have one further aim namely to provide the reader with the fastest, most direct route to acquiring a real hands-on understanding of image processing. We hope this book will give you a real fast-start in the field. Assumptions We make no assumptions about the reader’s mathematical background beyond that expected at the undergraduate level in the technical sciences – ie reasonable competence in calculus, matrix algebra and basic statistics. Why write this book? There are already a number of excellent and comprehensive texts on image processing and pattern recognition and we refer the interested reader to a number in the appendices of this book. There are also some exhaustive and well-written books on the Matlab language. What the authors felt was lacking was an image processing book which combines a simple exposition of principles with a means to quickly test, verify and experiment with them in an instructive and interactive way. In our experience, formed over a number of years, Matlab and the associated image processing toolbox are extremely well-suited to help achieve this aim. It is simple but powerful and its key feature in this context is that it enables one to concentrate on the image processing concepts and techniques (i.e. the real business at hand) while keeping concerns about programming syntax and data management to a minimum. What is Matlab? Matlab is a programming language with an associated set of specialist software toolboxes. It is an industry standard in scientific computing and used worldwide in the scientific, technical, industrial and educational sectors. Matlab is a commercial product and information on licences and their cost can be obtained direct by enquiry at the web-site www.mathworks.com. Many Universities all over the world provide site licenses for their students. What knowledge of Matlab is required for this book? Matlab is very much part of this book and we use it extensively to demonstrate how certain processing tasks and approaches can be quickly implemented and tried out in practice. Throughout the book, we offer comments on the Matlab language and the best way to achieve certain image processing tasks in that language. Thus the learning of concepts in image processing and their implementation within Matlab go hand-in-hand in this text. xii PREFACE
  • 16. Is the book any use then if I don’t know Matlab? Yes. This is fundamentally a book about image processing which aims to make the subject accessible and practical. It is not a book about the Matlab programming language. Although some prior knowledge of Matlab is an advantage and will make the practical implementa- tion easier, we have endeavoured to maintain a self-contained discussion of the concepts which will stand up apart from the computer-based material. If you have not encountered Matlab before and you wish to get the maximum from this book, please refer to the Matlab and Image Processing primer on the book website (http://www.fundipbook.com). This aims to give you the essentials on Matlab with a strong emphasis on the basic properties and manipulation of images. Thus, you do not have to be knowledgeable in Matlab to profit from this book. Practical issues To carry out the vast majority of the examples and exercises in the book, the reader will need access to a current licence for Matlab and the Image Processing Toolbox only. Features of this book and future support This book is accompanied by a dedicated website (http://www.fundipbook.com). The site is intended to act as a point of contact with the authors, as a repository for the code examples (Matlab .m files) used in the book and to host additional supporting materials for the reader and instructor. About the authors Chris Solomon gained a B.Sc in theoretical physics from Durham University and a Ph.D in Medical imaging from the Royal Marsden Hospital, University of London. Since 1994, he has been on the Faculty at the School of Physical Sciences where he is currently a Reader in Forensic Imaging. He has broad research interests focussing on evolutionary and genetic algorithms, image processing and statistical learning methods with a special interest in the human face. Chris is also Technical Director of Visionmetric Ltd, a company he founded in 1999 and which is now the UK’s leading provider of facial composite software and training in facial identification to police forces. He has received a number of UK and European awards for technology innovation and commercialisation of academic research. Toby Breckon holds a Ph.D in Informatics and B.Sc in Artificial Intelligence and Computer Science from the University of Edinburgh. Since 2006 he has been a lecturer in image processing and computer vision in the School of Engineering at Cranfield University. His key research interests in this domain relate to 3D sensing, real-time vision, sensor fusion, visual surveillance and robotic deployment. He is additionally a visiting member of faculty at Ecole Sup erieure des Technologies Industrielles Avanc ees (France) and has held visiting faculty positions in China and Japan. In 2008 he led the development of PREFACE xiii
  • 17. image-based automatic threat detection for the winning Stellar Team system in the UK MoD Grand Challenge. He is a Chartered Engineer (CEng) and an Accredited Imaging Scientist (AIS) as an Associate of the Royal Photographic Society (ARPS). Thanks The authors would like to thank the following people and organisations for their various support and assistance in the production of this book: the authors families and friends for their support and (frequent) understanding, Professor Chris Dainty (National University of Ireland), Dr. Stuart Gibson (University of Kent), Dr. Timothy Lukins (University of Edinburgh), The University of Kent, Cranfield University, VisionMetric Ltd and Wiley- Blackwell Publishers. For further examples and exercises see http://www.fundipbook.com xiv PREFACE
  • 18. Using the book website There is an associated website which forms a vital supplement to this text. It is: www.fundipbook.com The material on the site is mostly organised by chapter number and this contains – EXERCISES: intended to consolidate and highlight concepts discussed in the text. Some of these exercises are numerical/conceptual, others are based on Matlab. SUPPLEMENTARY MATERIAL: Proofs, derivations and other supplementary material referred to in the text are available from this section and are intended to consolidate, highlight and extend concepts discussed in the text. Matlab CODE: The Matlab code to all the examples in the book as well as the code used to create many of the figures are available in the Matlab code section. IMAGE DATABASE: The Matlab software allows direct access and use to a number of images as an integral part of the software. Many of these are used in the examples presented in the text. We also offer a modest repository of images captured and compiled by the authors which the reader may freely download and work with. Please note that some of the example Matlab code contained on the website and presented in the text makes use of these images. You will therefore need to download these images to run some of the Matlab code shown. We strongly encourage you to make use of the website and the materials on it. It is a vital link to making your exploration of the subject both practical and more in-depth. Used properly, it will help you to get much more from this book.
  • 19.
  • 20. 1 Representation In this chapter we discuss the representation of images, covering basic notation and information about images together with a discussion of standard image types and image formats. We end with a practical section, introducing Matlab’s facilities for reading, writing, querying, converting and displaying images of different image types and formats. 1.1 What is an image? A digital image can be considered as a discrete representation of data possessing both spatial (layout) and intensity (colour) information. As we shall see in Chapter 5, we can also consider treating an image as a multidimensional signal. 1.1.1 Image layout The two-dimensional (2-D) discrete, digital image Iðm; nÞ represents the response of some sensor (or simply a value of some interest) at a series of fixed positions (m ¼ 1; 2; . . . ; M; n ¼ 1; 2; . . . ; N) in 2-D Cartesian coordinates and is derived from the 2-D continuous spatial signal Iðx; yÞ through a sampling process frequently referred to as discretization. Discretization occurs naturally with certain types of imaging sensor (such as CCD cameras) and basically effects a local averaging of the continuous signal over some small (typically square) region in the receiving domain. The indices m and n respectively designate the rows and columns of the image. The individual picture elements or pixels of the image are thus referred to by their 2-D ðm; nÞ index. Following the Matlab convention, Iðm; nÞ denotes the response of the pixel located at the mth row and nth column starting from a top-left image origin (see Figure 1.1). In other imaging systems, a column–row convention may be used and the image origin in use may also vary. Although the images we consider in this book will be discrete, it is often theoretically convenient to treat an image as a continuous spatial signal: Iðx; yÞ. In particular, this sometimes allows us to make more natural use of the powerful techniques of integral and differential calculus to understand properties of images and to effectively manipulate and Fundamentals of Digital Image Processing A Practical Approach with Examples in Matlab Chris Solomon and Toby Breckon 2011 John Wiley Sons, Ltd
  • 21. process them. Mathematical analysis of discrete images generally leads to a linear algebraic formulation which is better in some instances. The individual pixel values in most images do actually correspond to some physical response in real 2-D space (e.g. the optical intensity received at the image plane of a camera or the ultrasound intensity at a transceiver). However, we are also free to consider images in abstract spaces where the coordinates correspond to something other than physical space and we may also extend the notion of an image to three or more dimensions. For example, medical imaging applications sometimes consider full three-dimensional (3-D) recon- struction of internal organs and a time sequence of such images (such as a beating heart) can be treated (if we wish) as a single four-dimensional (4-D) image in which three coordinates are spatial and the other corresponds to time. When we consider 3-D imaging we are often discussing spatial volumes represented by the image. In this instance, such 3-D pixels are denoted as voxels (volumetric pixels) representing the smallest spatial location in the 3-D volume as opposed to the conventional 2-D image. Throughout this book we will usually consider 2-D digital images, but much of our discussion will be relevant to images in higher dimensions. 1.1.2 Image colour An image contains one or more colour channels that define the intensity or colour at a particular pixel location Iðm; nÞ. In the simplest case, each pixel location only contains a single numerical value representing the signal level at that point in the image. The conversion from this set of numbers to an actual (displayed) image is achieved through a colour map. A colour map assigns a specific shade of colour to each numerical level in the image to give a visual representation of the data. The most common colour map is the greyscale, which assigns all shades of grey from black (zero) to white (maximum) according to the signal level. The Figure 1.1 The 2-D Cartesian coordinate space of an M x N digital image 2 CH 1 REPRESENTATION
  • 22. greyscale is particularly well suited to intensity images, namely images which express only the intensity of the signal as a single value at each point in the region. In certain instances, it can be better to display intensity images using a false-colour map. One of the main motives behind the use of false-colour display rests on the fact that the human visual system is only sensitive to approximately 40 shades of grey in the range from black to white, whereas our sensitivity to colour is much finer. False colour can also serve to accentuate or delineate certain features or structures, making them easier to identify for the human observer. This approach is often taken in medical and astronomical images. Figure 1.2 shows an astronomical intensity image displayed using both greyscale and a particular false-colour map. In this example the jet colour map (as defined in Matlab) has been used to highlight the structure and finer detail of the image to the human viewer using a linear colour scale ranging from dark blue (low intensity values) to dark red (high intensity values). The definition of colour maps, i.e. assigning colours to numerical values, can be done in any way which the user finds meaningful or useful. Although the mapping between the numerical intensity value and the colour or greyscale shade is typically linear, there are situations in which a nonlinear mapping between them is more appropriate. Such nonlinear mappings are discussed in Chapter 4. In addition to greyscale images where we have a single numerical value at each pixel location, we also have true colour images where the full spectrum of colours can be represented as a triplet vector, typically the (R,G,B) components at each pixel location. Here, the colour is represented as a linear combination of the basis colours or values and the image may be considered as consisting of three 2-D planes. Other representations of colour are also possible and used quite widely, such as the (H,S,V) (hue, saturation and value (or intensity)). In this representation, the intensity V of the colour is decoupled from the chromatic information, which is contained within the H and S components (see Section 1.4.2). 1.2 Resolution and quantization The size of the 2-D pixel grid together with the data size stored for each individual image pixel determines the spatial resolution and colour quantization of the image. Figure 1.2 Example of grayscale (left) and false colour (right) image display (See colour plate section for colour version) 1.2 RESOLUTION AND QUANTIZATION 3
  • 23. The representational power (or size) of an image is defined by its resolution. The resolution of an image source (e.g. a camera) can be specified in terms of three quantities: . Spatial resolution The column (C) by row (R) dimensions of the image define the numberofpixelsusedtocoverthevisualspacecapturedbytheimage.Thisrelatestothe sampling of the image signal and is sometimes referred to as the pixel or digital resolution of the image. It is commonly quoted as C R (e.g. 640 480, 800 600, 1024 768, etc.) . Temporal resolution For a continuous capture system such as video, this is the number of images captured in a given time period. It is commonly quoted in frames per second (fps), where each individual image is referred to as a video frame (e.g. commonly broadcast TV operates at 25 fps; 25–30 fps is suitable for most visual surveillance; higher frame-rate cameras are available for specialist science/engineering capture). . Bit resolution This defines the number of possible intensity/colour values that a pixel may have and relates to the quantization of the image information. For instance a binary image has just two colours (black or white), a grey-scale image commonly has 256 different grey levels ranging from black to white whilst for a colour image it depends on the colour range in use. The bit resolution is commonly quoted as the number of binary bits required forstorage at a given quantization level, e.g. binary is 2bit, grey-scale is 8bit and colour (most commonly) is 24 bit. The range of values a pixel may take is often referred to as the dynamic range of an image. It is important to recognize that the bit resolution of an image does not necessarily correspond to the resolution of the originating imaging system. A common feature of many cameras is automatic gain, in which the minimum and maximum responses over the image field are sensed and this range is automatically divided into a convenient number of bits (i.e. digitized into N levels). In such a case, the bit resolution of the image is typically less than that which is, in principle, achievable by the device. By contrast, the blind, unadjusted conversion of an analog signal into a given number of bits, for instance 216 ¼ 65 536 discrete levels, does not, of course, imply that the true resolution of the imaging device as a whole is actually 16 bits. This is because the overall level of noise (i.e. random fluctuation) in the sensor and in the subsequent processing chain may be of a magnitude which easily exceeds a single digital level. The sensitivity of an imaging system is thus fundamentally determined by the noise, and this makes noise a key factor in determining the number of quantization levels used for digitization. There is no point in digitizing an image to a high number of bits if the level of noise present in the image sensor does not warrant it. 1.2.1 Bit-plane splicing The visual significance of individual pixel bits in an image can be assessed in a subjective but useful manner by the technique of bit-plane splicing. To illustrate the concept, imagine an 8-bit image which allows integer values from 0 to 255. This can be conceptually divided into eight separate image planes, each corresponding 4 CH 1 REPRESENTATION
  • 24. Figure 1.3 An example of bit-plane slicing a grey-scale image to the values of a given bit across all of the image pixels. The first bit plane comprises the first and most significant bit of information (intensity ¼ 128), the second, the second most significant bit (intensity ¼ 64) and so on. Displaying each of the bit planes in succession, we may discern whether there is any visible structure in them. In Figure 1.3, we show the bit planes of an 8-bit grey-scale image of a car tyre descending from the most significant bit to the least significant bit. It is apparent that the two or three least significant bits do not encode much useful visual information (it is, in fact, mostly noise). The sequence of images on the right in Figure 1.3 shows the effect on the original image of successively setting the bit planes to zero (from the first and most significant to the least significant). In a similar fashion, we see that these last bits do not appear to encode any visible structure. In this specific case, therefore, we may expect that retaining only the five most significant bits will produce an image which is practically visually identical to the original. Such analysis could lead us to a more efficient method of encoding the image using fewer bits – a method of image compression. We will discuss this next as part of our examination of image storage formats. 1.3 Image formats From a mathematical viewpoint, any meaningful 2-D array of numbers can be considered as an image. In the real world, we need to effectively display images, store them (preferably 1.3 IMAGE FORMATS 5
  • 25. compactly), transmit them over networks and recognize bodies of numerical data as corresponding to images. This has led to the development of standard digital image formats. In simple terms, the image formats comprise a file header (containing informa- tion on how exactly the image data is stored) and the actual numeric pixel values themselves. There are a large number of recognized image formats now existing, dating back over more than 30 years of digital image storage. Some of the most common 2-D image formats are listed in Table 1.1. The concepts of lossy and lossless compression are detailed in Section 1.3.2. As suggested by the properties listed in Table 1.1, different image formats are generally suitable for different applications. GIF images are a very basic image storage format limited to only 256 grey levels or colours, with the latter defined via a colour map in the file header as discussed previously. By contrast, the commonplace JPEG format is capable of storing up to a 24-bit RGB colour image, and up to 36 bits for medical/scientific imaging applications, and is most widely used for consumer-level imaging such as digital cameras. Other common formats encountered include the basic bitmap format (BMP), originating in the develop- ment of the Microsoft Windows operating system, and the new PNG format, designed as a more powerful replacement for GIF. TIFF, tagged image file format, represents an overarching and adaptable file format capable of storing a wide range of different image data forms. In general, photographic-type images are better suited towards JPEG or TIF storage, whilst images of limited colour/detail (e.g. logos, line drawings, text) are best suited to GIF or PNG (as per TIFF), as a lossless, full-colour format, is adaptable to the majority of image storage requirements. 1.3.1 Image data types The choice of image format used can be largely determined by not just the image contents, but also the actual image data type that is required for storage. In addition to the bit resolution of a given image discussed earlier, a number of distinct image types also exist: . Binary images are 2-D arrays that assign one numerical value from the set f0; 1g to each pixel in the image. These are sometimes referred to as logical images: black corresponds Table 1.1 Common image formats and their associated properties Acronym Name Properties GIF Graphics interchange format Limited to only 256 colours (8 bit); lossless compression JPEG Joint Photographic Experts Group In most common use today; lossy compression; lossless variants exist BMP Bit map picture Basic image format; limited (generally) lossless compression; lossy variants exist PNG Portable network graphics New lossless compression format; designed to replace GIF TIF/TIFF Tagged image (file) format Highly flexible, detailed and adaptable format; compressed/uncompressed variants exist 6 CH 1 REPRESENTATION
  • 26. to zero (an ‘off’ or ‘background’ pixel) and white corresponds to one (an ‘on’ or ‘foreground’ pixel). As no other values are permissible, these images can be represented as a simple bit-stream, but in practice they are represented as 8-bit integer images in the common image formats. A fax (or facsimile) image is an example of a binary image. . Intensity or grey-scale images are 2-D arrays that assign one numerical value to each pixel which is representative of the intensity at this point. As discussed previously, the pixel value range is bounded by the bit resolution of the image and such images are stored as N-bit integer images with a given format. . RGB or true-colour images are 3-D arrays that assign three numerical values to each pixel, each value corresponding to the red, green and blue (RGB) image channel component respectively. Conceptually, we may consider them as three distinct, 2-D planes so that they are of dimension C by R by 3, where R is the number of image rows and C the number of image columns. Commonly, such images are stored as sequential integers in successive channel order (e.g. R0G0B0, R1G1B1, . . .) which are then accessed (as in Matlab) by IðC; R; channelÞ coordinates within the 3-D array. Other colour representations which we will discuss later are similarly stored using the 3-D array concept, which can also be extended (starting numerically from 1 with Matlab arrays) to four or more dimensions to accommodate additional image information, such as an alpha (transparency) channel (as in the case of PNG format images). . Floating-point images differ from the other image types we have discussed. By defini- tion, they do not store integer colour values. Instead, they store a floating-point number which, within a given range defined by the floating-point precision of the image bit- resolution, represents the intensity. They may (commonly) represent a measurement value other than simple intensity or colour as part of a scientific or medical image. Floating point images are commonly stored in the TIFF image format or a more specialized, domain-specific format (e.g. medical DICOM). Although the use of floating-point images is increasing through the use of high dynamic range and stereo photography, file formats supporting their storage currently remain limited. Figure 1.4 shows an example of the different image data types we discuss with an example of a suitable image format used for storage. Although the majority of images we will encounter in this text will be of integer data types, Matlab, as a general matrix-based data analysis tool, can of course be used to process floating-point image data. 1.3.2 Image compression The other main consideration in choosing an image storage format is compression. Whilst compressing an image can mean it takes up less disk storage and can be transferred over a network in less time, several compression techniques in use exploit what is known as lossy compression.Lossycompressionoperatesbyremovingredundantinformationfromtheimage. As the example of bit-plane slicing in Section 1.2.1 (Figure 1.3) shows, it is possible to remove some information from an image without any apparent change in its visual 1.3 IMAGE FORMATS 7
  • 27. appearance. Essentially, if such information is visually redundant then its transmission is unnecessary for appreciation of the image. The form of the information that can be removed is essentially twofold. It may be in terms of fine image detail (as in the bit-slicing example) or it may be through a reduction in the number of colours/grey levels in a way that is not detectable by the human eye. Some of the image formats we have presented, store the data in such a compressed form (Table 1.1). Storage of an image in one of the compressed formats employs various algorithmic procedures to reduce the raw image data to an equivalent image which appears identical (or at least nearly) but requires less storage. It is important to distinguish between compression which allows the original image to be reconstructed perfectly from the reduced data without any loss of image information (lossless compression) and so-called lossy compression techniques which reduce the storage volume (sometimes dramatically) at the expense of some loss of detail in the original image as shown in Figure 1.5, the lossless and lossy compression techniques used in common image formats can significantly reduce the amount of image information that needs to be stored, but in the case of lossy compression this can lead to a significant reduction in image quality. Lossy compression is also commonly used in video storage due to the even larger volume of source data associated with a large sequence of image frames. This loss of information, itself a form of noise introduced into the image as compression artefacts, can limit the effectiveness of later image enhancement and analysis. Figure 1.4 Examples of different image types and their associated storage formats 8 CH 1 REPRESENTATION
  • 28. In terms of practical image processing in Matlab, it should be noted that an image written to file from Matlab in a lossy compression format (e.g. JPEG) will not be stored as the exact Matlab image representation it started as. Image pixel values will be altered in the image output process as a result of the lossy compression. This is not the case if a lossless compression technique is employed. An interesting Matlab exercise is posed for the reader in Exercise 1.4 to illustrate this difference between storage in JPEG and PNG file formats. 1.4 Colour spaces Aswasbrieflymentionedinourearlierdiscussionofimagetypes,therepresentationofcolours inanimageisachievedusingacombinationofoneormorecolourchannelsthatarecombined toformthecolourusedintheimage.Therepresentationweusetostorethecolours,specifying the number and nature of the colour channels, is generally known as the colour space. Considered as a mathematical entity, an image is really only a spatially organized set of numbers with each pixel location addressed as IðC; RÞ. Grey-scale (intensity) or binary images are 2-D arrays that assign one numerical value to each pixel which isrepresentative of Figure 1.5 Example image compressed using lossless and varying levels of lossy compression (See colour plate section for colour version) 1.4 COLOUR SPACES 9
  • 29. Figure 1.6 Colour RGB image separated into its red (R), green (G) and blue (B) colour channels (See colour plate section for colour version) the intensity at that point. They use a single-channel colour space that is either limited to a 2-bit (binary) or intensity (grey-scale) colour space. By contrast, RGB or true-colour images are 3-D arrays that assign three numerical values to each pixel, each value corresponding to the red, green and blue component respectively. 1.4.1 RGB RGB (or true colour) images are 3-D arrays that we may consider conceptually as three distinct 2-D planes, one corresponding to each of the three red (R), green (G) and blue (B) colour channels. RGB is the most common colour space used for digital image representa- tion as it conveniently corresponds to the three primary colours which are mixed for display on a monitor or similar device. We can easily separate and view the red, green and blue components of a true-colour image, as shown in Figure 1.6. It is important to note that the colours typically present in a real image are nearly always a blend of colour components from all three channels. A common misconception is that, for example, items that are perceived as blue will only appear in the blue channel and so forth. Whilst items perceived as blue will certainly appear brightest in the blue channel (i.e. they will contain more blue light than the other colours) they will also have milder components of red and green. If we consider all the colours that can be represented within the RGB representation, then we appreciate that the RGB colour space is essentially a 3-D colour space (cube) with axes R, G and B (Figure 1.7). Each axis has the same range 0 ! 1 (this is scaled to 0–255 for the common 1 byte per colour channel, 24-bit image representation). The colour black occupies the origin of the cube (position ð0; 0; 0Þ), corresponding to the absence of all three colours; white occupies the opposite corner (position ð1; 1; 1Þ), indicating the maximum amount of all three colours. All other colours in the spectrum lie within this cube. The RGB colour space is based upon the portion of the electromagnetic spectrum visible to humans (i.e. the continuous range of wavelengths in the approximate range 10 CH 1 REPRESENTATION
  • 30. Figure 1.7 Anillustration ofRGBcolourspaceasa3-Dcube(Seecolourplatesectionforcolour version) 400–700 nm). The human eye has three different types of colour receptor over which it has limited (and nonuniform) absorbency for each of the red, green and blue wavelengths. This is why, as we will see later, the colour to grey-scale transform uses a nonlinear combination of the RGB channels. In digital image processing we use a simplified RGB colour model (based on the CIE colour standard of 1931) that is optimized and standardized towards graphical displays. However, the primary problem with RGB is that it is perceptually nonlinear. By this we mean that moving in a given direction in the RGB colour cube (Figure 1.7) does not necessarily produce a colour that is perceptually consistent with the change in each of the channels. For example, starting at white and subtracting the blue component produces yellow; similarly, starting at red and adding the blue component produces pink. For this reason, RGB space is inherently difficult for humans to work with and reason about because it is not related to the natural way we perceive colours. As an alternative we may use perceptual colour representations such as HSV. 1.4.1.1 RGB to grey-scale image conversion We can convert from an RGB colour space to a grey-scale image using a simple transform. Grey-scale conversion is the initial step in many image analysis algorithms, as it essentially simplifies (i.e. reduces) the amount of information in the image. Although a grey-scale image contains less information than a colour image, the majority of important, feature- related information is maintained, such as edges, regions, blobs, junctions and so on. Feature detection and processing algorithms then typically operate on the converted grey- scale version of the image. As we can see from Figure 1.8, it is still possible to distinguish between the red and green apples in grey-scale. An RGB colour image, Icolour, is converted to grey scale, Igrey-scale, using the following transformation: Igrey-scaleðn; mÞ ¼ aIcolourðn; m; rÞ þ bIcolourðn; m; gÞ þ gIcolourðn; m; bÞ ð1:1Þ 1.4 COLOUR SPACES 11
  • 31. Figure 1.8 An example of RGB colour image (left) to grey-scale image (right) conversion (See colour plate section for colour version) where ðn; mÞ indexes an individual pixel within the grey-scale image and ðn; m; cÞ the individual channel at pixel location ðn; mÞ in the colour image for channel c in the red r, blue b and green g image channels. As is apparent from Equation (1.1), the grey-scale image is essentially a weighted sum of the red, green and blue colour channels. The weighting coefficients (a, b and g) are set in proportion to the perceptual response of the human eye to each of the red, green and blue colour channels and a standardized weighting ensures uniformity (NTSC television standard, a ¼ 0.2989, b ¼ 0.5870 and g ¼ 0.1140). The human eye is naturally more sensitive to red and green light; hence, these colours are given higher weightings to ensure that the relative intensity balance in the resulting grey-scale image is similar to that of the RGB colour image. An example of performing a grey-scale conversion in Matlab is given in Example 1.6. RGB to grey-scale conversion is a noninvertible image transform: the true colour information that is lost in the conversion cannot be readily recovered. 1.4.2 Perceptual colour space Perceptual colour space is an alternative way of representing true colour images in a manner that is more natural to the human perception and understanding of colour than the RGB representation. Many alternative colour representations exist, but here we concentrate on the Hue, Saturation and Value (HSV) colour space popular in image analysis applications. Changes within this colour space follow a perceptually acceptable colour gradient. From an image analysis perspective, it allows the separation of colour from lighting to a greater degree. An RGB image can be transformed into an HSV colour space representation as shown in Figure 1.9. Each of these three parameters can be interpreted as follows: . H (hue) is the dominant wavelength of the colour, e.g. red, blue, green . S (saturation) is the ‘purity’ of colour (in the sense of the amount of white light mixed with it) . V (value) is the brightness of the colour (also known as luminance). 12 CH 1 REPRESENTATION
  • 32. The HSV representation of a 2-D image is also as a 3-D array comprising three channels ðh; s; vÞ and each pixel location within the image, Iðn; mÞ, contains an ðh; s; vÞ triplet that can be transformed back into RGB for true-colour display. In the Matlab HSV implementation each of h, s and v are bounded within the range 0 ! 1. For example, a blue hue (top of cone, Figure 1.9) may have a value of h ¼ 0.9, a saturation of s ¼ 0.5 and a value v ¼ 1 making it a vibrant, bright sky-blue. By examining the individual colour channels of images in the HSV space, we can see that image objects are more consistently contained in the resulting hue field than in the channels of the RGB representation, despite the presence of varying lighting conditions over the scene (Figure 1.10). As a result, HSV space is commonly used for colour-based Figure 1.9 HSV colour space as a 3-D cone (See colour plate section for colour version) Figure 1.10 Image transformed and displayed in HSV colour space (See colour plate section for colour version) 1.4 COLOUR SPACES 13
  • 33. image segmentation using a technique known as colour slicing. A portion of the hue colour wheel (a slice of the cone, Figure 1.9) is isolated as the colour range of interest, allowing objects within that colour range to be identified within the image. This ease of colour selection in HSV colour space also results in its widespread use as the preferred method of colour selection in computer graphical interfaces and as a method of adding false colour to images (Section 1.1.2). Details of RGB to HSV image conversion in Matlab are given in Exercise 1.6. 1.5 Images in Matlab Having introduced the basics of image representation, we now turn to the practical aspect of this book to investigate the initial stages of image manipulation using Matlab. These are presented as a number of worked examples and further exercises for the reader. 1.5.1 Reading, writing and querying images Reading and writing images is accomplished very simply via the imread and imwrite functions. These functions support all of the most common image formats and create/ export the appropriate 2-D/3-D image arrays within the Matlab environment. The function imfinfo can be used to query an image and establish all its important properties, including its type, format, size and bit depth. Example 1.1 Matlab code What is happening? imfinfo(‘cameraman.tif ’) %Query the cameraman image that %is available with Matlab %imfinfo provides information %ColorType is gray scale, width is 256 . . . etc. I1¼imread(‘cameraman.tif ’); %Read in the TIF format cameraman image imwrite(I1,’cameraman.jpg’,’jpg’); %Write the resulting array I1 to %disk as a JPEG image imfinfo(‘cameraman.jpg’) %Query the resulting disk image %Note changes in storage size, etc. Comments . Matlab functions: imread, imwrite and iminfo. . Note the change in file size when the image is stored as a JPEG image. This is due to the (lossy) compression used by the JPEG image format. 14 CH 1 REPRESENTATION
  • 34. 1.5.2 Basic display of images Matlab provides two basic functions for image display: imshow and imagesc. Whilst imshow requires that the 2-D array specified for display conforms to an image data type (e.g. intensity/colour images with value range 0–1 or 0–255), imagesc accepts input arrays of any Matlab storage type (uint 8, uint 16 or double) and any numerical range. This latter function then scales the input range of the data and displays it using the current/default colour map. We can additionally control this display feature using the colormap function. Example 1.2 Matlab code What is happening? A¼imread(‘cameraman.tif ’); %Read in intensity image imshow(A); %First display image using imshow imagesc(A); %Next display image using imagesc axis image; %Correct aspect ratio of displayed image axis off; %Turn off the axis labelling colormap(gray); %Display intensity image in grey scale Comments . Matlab functions: imshow, imagesc and colormap. . Note additional steps required when using imagesc to display conventional images. In order to show the difference between the two functions we now attempt the display of unconstrained image data. Example 1.3 Matlab code What is happening? B¼rand(256). 1000; %Generate random image array in range 0 1000 imshow(B); %Poor contrast results using imshow because data %exceeds expected range imagesc(B); %imagesc automatically scales colourmap to data axis image; axis off; %range colormap(gray); colorbar; imshow(B,[0 1000]); %But if we specify range of data explicitly then %imshow also displays correct image contrast Comments . Note the automatic display scaling of imagesc. 1.5 IMAGES IN MATLAB 15
  • 35. If we wish to display multiple images together, this is best achieved by the subplot function. This function creates a mosaic of axes into which multiple images or plots can be displayed. Example 1.4 Matlab code What is happening? B¼imread(‘cell.tif ’); %Read in 8 bit intensity image of cell C¼imread(‘spine.tif ’); %Read in 8 bit intensity image of spine D¼imread(‘onion.png’); %Read in 8 bit colour image subplot(3,1,1); imagesc(B); axis image; %Creates a 3 1 mosaic of plots axis off; colormap(gray); %and display first image subplot(3,1,2); imagesc(C); axis image; %Display second image axis off; colormap(jet); %Set colourmap to jet (false colour) subplot(3,1,3); imshow(D); %Display third (colour) image Comments . Note the specification of different colour maps using imagesc and the combined display using both imagesc and imshow. 1.5.3 Accessing pixel values Matlab also contains a built-in interactive image viewer which can be launched using the imview function. Its purpose is slightly different from the other two: it is a graphical, image viewer which is intended primarily for the inspection of images and sub-regions within them. Example 1.5 Matlab code What is happening? B¼imread(‘cell.tif ’); %Read in 8 bit intensity image of cell imview(B); %Examine grey scale image in interactive viewer D¼imread(‘onion.png’); %Read in 8 bit colour image. imview(B); %Examine RGB image in interactive viewer B(25,50) %Print pixel value at location (25,50) B(25,50)¼255; %Set pixel value at (25,50) to white imshow(B); %View resulting changes in image D(25,50,:) %Print RGB pixel value at location (25,50) D(25,50, 1) %Print only the red value at (25,50) 16 CH 1 REPRESENTATION
  • 36. D(25,50,:)¼(255, 255, 255); %Set pixel value to RGB white imshow(D); %View resulting changes in image Comments . Matlab functions: imview. . Note how we can access individual pixel values within the image and change their value. 1.5.4 Converting image types Matlab also contains built in functions for converting different image types. Here, we examine conversion to grey scale and the display of individual RGB colour channels from an image. Example 1.6 Matlab code What is happening? D¼imread(‘onion.png’); %Read in 8 bit RGB colour image Dgray¼rgb2gray(D); %Convert it to a grey scale image subplot(2,1,1); imshow(D); axis image; %Display both side by side subplot(2,1,2); imshow(Dgray); Comments . Matlab functions: rgb2gray. . Note how the resulting grayscale image array is 2 D while the originating colour image array was 3 D. Example 1.7 Matlab code What is happening? D¼imread(‘onion.png’); %Read in 8 bit RGB colour image. Dred¼D(:,:,1); %Extract red channel (first channel) Dgreen¼D(:,:,2); %Extract green channel (second channel) Dblue¼D(:,:,3); %Extract blue channel (third channel) subplot(2,2,1); imshow(D); axis image; %Display all in 2 2 plot subplot(2,2,2); imshow(Dred); title(‘red’); %Display and label subplot(2,2,3); imshow(Dgreen); title(‘green’); subplot(2,2,4); imshow(Dblue); title(‘blue’); Comments . Note how we can access individual channels of an RGB image and extract them as separate images in their own right. 1.5 IMAGES IN MATLAB 17
  • 37. Exercises The following exercises are designed to reinforce and develop the concepts and Matlab examples introduced in this chapter Matlab functions: imabsdiff, rgb2hsv. Exercise 1.1 Using the examples presented for displaying an image in Matlab together with those for accessing pixel locations, investigate adding and subtracting a scalar value from an individual location, i.e. Iði; jÞ ¼ Iði; jÞ þ 25 or Iði; jÞ ¼ Iði; jÞ25. Start by using the grey-scale‘cell.tif’ example imageand pixel location ð100; 20Þ. What is the effecton the grey- scale colour of adding and subtracting? Expand your technique to RGB colour images by adding and subtracting to all three of the colour channels in a suitable example image. Also try just adding to one of the individual colour channels whilst leaving the others unchanged. What is the effect on the pixel colour of each of these operations? Exercise 1.2 Based on your answer to Exercise 1.1, use the for construct in Matlab (see help for at the Matlab command prompt) to loop over all the pixels in the image and brighten or darken the image. You will need to ensure that your program does not try to create a pixel value that is larger or smaller than the pixelcanhold. For instance,an 8-bitimage can only hold the values 0–255 at each pixel location and similarly for each colour channel for a 24-bit RGB colour image. Exercise 1.3 Using the grey-scale ‘cell.tif’ example image, investigate using different false colour maps to display the image. The Matlab function colormap can take a range of values to specify different false colour maps: enter help graph3d and look under the Color maps heading to get a full list. What different aspects and details of the image can be seen using these false colourings in place of the conventional grey-scale display? False colour maps can also be specified numerically as parameters to the colormap command: enter help colormap for further details. Exercise 1.4 Load an example image into Matlab and using the functions introduced in Example 1.1 save it once as a JPEG format file (e.g. sample.jpg) and once as a PNG format image (e.g. sample.png). Next, reload the images from both of these saved files as new images in Matlab, ‘Ijpg’ and ‘Ipng’. We may expect these two images to be exactly the same, as they started out as the same image and were just saved in different image file formats. If we compare them by subtracting one from the other and taking the absolute difference at each pixel location we can check whether this assumption is correct. Use the imabsdiff Matlab command to create a difference image between ‘Ijpg’ and ‘Ipng’. Display the resulting image using imagesc. The difference between these two images is not all zeros as one may expect, but a noise pattern related to the difference in the images introduced by saving in a lossy compression format (i.e. JPEG) and a lossless compression format (i.e. PNG). The difference we see is due 18 CH 1 REPRESENTATION
  • 38. to the image information removed in the JPEG version of the file which is not apparent to us when we look at the image. Interestingly, if we view the difference image with imshow all we see is a black image because the differences are so small they have very low (i.e. dark) pixel values. The automatic scaling and false colour mapping of imagesc allows us to visualize these low pixel values. Exercise 1.5 Implement a program to perform the bit-slicing technique described in Section 1.2.1 and extract/display the resulting plane images (Figure 1.3) as separate Matlab images. You may wish to consider displaying a mosaic of several different bit-planes from an image using the subplot function. Exercise 1.6 Using the Matlab rgb2hsv function, write a program to display the individual hue, saturation and value channels of a given RGB colour image. You may wish to refer to Example 1.6 on the display of individual red, green and blue channels. For further examples and exercises see http://www.fundipbook.com EXERCISES 19
  • 39.
  • 40. 2 Formation All digital images have to originate from somewhere. In this chapter we consider the issue of image formation both from a mathematical and an engineering perspective. The origin and characteristics of an image can have a large bearing on how we can effectively process it. 2.1 How is an image formed? The image formation process can be summarized as a small number of key elements. In general, a digital image s can be formalized as a mathematical modelcomprising a functional representation of the scene (the object function o)and that of the capture process(the point- spread function (PSF) p). Additionally, the image will contain additive noise n. These are essentially combined as follows to form an image: Image ¼ PSF object function þ noise s ¼ p o þ n ð2:1Þ In this process we have several key elements: . PSF this describes the way information on the object function is spread as a result of recording the data. It is a characteristic of the imaging instrument (i.e. camera) and is a deterministic function (that operates in the presence of noise). . Object function This describes the object (or scene) that is being imaged (its surface or internal structure, for example) and the way light is reflected from that structure to the imaging instrument. . Noise This is a nondeterministic function which can, at best, only be described in terms of some statistical noise distribution (e.g. Gaussian). Noise is a stochastic function which is a consequence of all the unwanted external disturbances that occur during the recording of the image data. . Convolution operator A mathematical operation which ‘smears’ (i.e. convolves) one function with another. Fundamentals of Digital Image Processing A Practical Approach with Examples in Matlab Chris Solomon and Toby Breckon 2011 John Wiley Sons, Ltd
  • 41. Here, the function of the light reflected from the object/scene (object function) is trans- formed into the image data representation by convolution with the PSF. This function characterizes the image formation (or capture) process. The process is affected by noise. The PSF is a characteristic of the imaging instrument (i.e. camera). It represents the response of the system to a point source in the object plane, as shown in Figure 2.1, where we can also consider an imaging system as an input distribution (scene light) to output distribution (image pixels) mapping function consisting both of the PSF itself and additive noise (Figure 2.1 (lower)). From this overview we will consider both the mathematical representation of the image formation process (Section 2.2), useful as a basis for our later consideration of advanced image-processing representations (Chapter 5), and from an engineering perspective in terms of physical camera imaging (Section 2.3). 2.2 The mathematics of image formation The formation process of an image can be represented mathematically. In our later consideration of various processing approaches (see Chapters 3–6) this allows us to reason mathematically using knowledge of the conditions under which the image originates. 2.2.1 Introduction In a general mathematical sense, we may view image formation as a process which transforms an input distribution into an output distribution. Thus, a simple lens may be viewed as a ‘system’ that transforms a spatial distribution of light in one domain (the object Figure 2.1 An overview of the image formation ‘system’ and the effect of the PSF 22 CH 2 FORMATION
  • 42. plane) to a distribution in another (the image plane). Similarly, a medical ultrasound imaging system transforms a set of spatially distributed acoustic reflection values into a corresponding set of intensity signals which are visually displayed as a grey-scale intensity image. Whatever the specific physical nature of the input and output distributions, the concept of a mapping between an input distribution (the thing you want to investigate, see or visualize) and an output distribution (what you actually measure or produce with your system) is valid. The systems theory approach to imaging is a simple and convenient way of conceptualizing the imaging process. Any imaging device isa system, or a‘black box’, whose properties are defined by the way in which an input distribution is mapped to an output distribution. Figure 2.2 summarizes this concept. The process by which an imaging system transforms the input into an output can be viewed from an alternative perspective, namely that of the Fourier or frequency domain. From this perspective, images consist of a superposition of harmonic functions of different frequencies. Imaging systems then act upon the spatial frequency content of the input to produce an output with a modified spatial frequency content. Frequency-domain methods are powerful and important in image processing, and we will offer a discussion of such methods later in Chapter 5. First however, we are going to devote some time to understanding the basic mathematics of image formation. 2.2.2 Linear imaging systems Linear systems and operations are extremely important in image processing because the majority of real-world imaging systems may be well approximated as linear systems. Moreover, there is a thorough and well-understood body of theory relating to linear systems. Nonlinear theory is still much less developed and understood, and deviations from strict linearity are often best handled in practice by approximation techniques which exploit the better understood linear methods. An imaging system described by operator S is linear if for any two input distributions X and Y and any two scalars a and b we have SfaX þ bYg ¼ aSfXg þ bSfYg ð2:2Þ In other words, applying the linear operator to a weighted sum of two inputs yields the same result as first applying the operator to the inputs independently and then combining the weighted outputs. To make this concept concrete, consider the two simple input INPUT DISTRIBUTION I OUTPUT DISTRIBUTION O SYSTEM S S(I) = O Figure 2.2 Systems approach to imaging. The imaging process is viewed as an operator S which acts on the input distribution I to produce the output O 2.2 THE MATHEMATICS OF IMAGE FORMATION 23
  • 43. distributions depicted in Figure 2.3 consisting of a cross and a circle. These radiate some arbitrary flux (optical photons, X-rays, ultrasonic waves or whatever) which are imper- fectly imaged by our linear system. The first row of Figure 2.3 shows the two input distributions, their sum and then the result of applying the linear operator (a blur) to the sum. The second row shows the result of first applying the operator to the individual distributions and then the result of summing them. In each case the final result is the same. The operator applied in Figure 2.3 is a convolution with Gaussian blur, a topic we will expand upon shortly. 2.2.3 Linear superposition integral Consider Figure 2.4, in which we have some general 2-D input function f ðx0 ; y0 Þ in an input domain ðx0 ; y0 Þ and the 2-D response gðx; yÞ of our imaging system to this input in the output domain ðx; yÞ. In the most general case, we should allow for the possibility that each and every point in the input domain may contribute in some way to the output. If the system is linear, however, the contributions to the final output must combine linearly. For this reason, basic linear image formation is described by an integral operator which is called the linear superposition integral: gðx; yÞ ¼ Z Z f ðx0 ; y0 Þhðx; y; x0 ; y0 Þ dx0 dy0 ð2:3Þ This integral actually expresses something quite simple. To understand this, consider some arbitrary but specific point in the output domain with coordinates ðx; yÞ. We wish to know Figure 2.3 Demonstrating the action of a linear operator S. Applying the operator (a blur in this case) to the inputs and then linearly combining the results produces the same result as linearly combining them and then applying the operator 24 CH 2 FORMATION
  • 44. gðx; yÞ, the output response at that point. The linear superposition integral can be understood by breaking it down into three steps: (1) Take the value of the input function f at some point in the input domain ðx0 ; y0 Þ and multiply it by some weight h, with h determining the amount by which the input flux at this particular point contributes to the output point. (2) Repeat this for each and every valid point in the input domain multiplying by the appropriate weight each time. (3) Sum (i.e. integrate) all such contributions to give the response gðx; yÞ. Clearly, it is the weighting function h which determines the basic behaviour of the imaging system. This function tells us the specific contribution made by each infinitesimal point in the input domain to each infinitesimal point in the resulting output domain. In the most general case, it is a function of four variables, since we must allow for the contribution of a given point ðx0 ; y0 Þ in the input space to a particular point ðx; yÞ in the output space to depend on the exact location of both points. In the context of imaging, the weighting function h is referred to as the point-spread function (PSF). The reason for this name will be demonstrated shortly. First, however, we introduce an important concept in imaging: the (Dirac) delta or impulse function. 2.2.4 The Dirac delta or impulse function In image processing, the delta or impulse function is used to represent mathematically a bright intensity source which occupies a very small (infinitesimal) region in space. It can be Figure 2.4 The linear superposition principle. Each point in the output is given by a weighted sum (integral) of all input points. The weight function is called the point-spread function and specifies the contribution of each and every input point to each and every output point 2.2 THE MATHEMATICS OF IMAGE FORMATION 25
  • 45. modelled in a number of ways,1 but arguably the simplest is to consider it as the limiting form of a scaled rectangle function as the width of the rectangle tends to zero. The 1-D rectangle function is defined as rect x a ¼ 1 jxj a=2 ¼ 0 otherwise ð2:4Þ Accordingly, the 1-D and 2-D delta function can be defined as dðxÞ ¼ lim a ! 0 1 a rect x a in 1-D dðx; yÞ ¼ lim a ! 0 1 a2 rect x a rect y a in 2-D ð2:5Þ In Figure 2.5 we show the behaviour of the scaled rectangle function as a ! 0. We see that: As a ! 0 the support (the nonzero region) of the function tends to a vanishingly small region either side of x ¼ 0. As a ! 0 the height of the function tends to infinity but the total area under the function remains equal to one. dðxÞ is thus a function which is zero everywhere except at x ¼ 0 precisely. At this point, the function tends to a value of infinity but retains a finite (unit area) under the function. a a a a 1 a 1 a x δ (x) δ (x) dx = 1 δ (x) = lim ∞ ∞ −∞ 冕 1 a 1 a x ⎛ ⎛ ⎛ ⎛ rect Figure 2.5 The Dirac delta or impulse function can be modelled as the limiting form of a scaled rectanglefunction asits width tends to zero. Notethat the area under the delta function is equalto unity 1 An alternative is the limiting form of a Gaussian function as the standard deviation s ! 0. 26 CH 2 FORMATION
  • 46. Thus: dðxÞ ¼ ¥ x ¼ 0 ¼ 0 x 6¼ 0 ð2:6Þ ð ¥ ¥ dðxÞ dx ¼ 1 ð2:7Þ and it follows that a shifted delta function corresponding to an infinitesimal point located at x ¼ x0 is defined in exactly the same way, as dðxx0Þ ¼ ¥ x ¼ x0 ¼ 0 x 6¼ x0 ð2:8Þ These results extend naturally to two dimensions and more: dðx; yÞ ¼ ¥ x ¼ 0; y ¼ 0 ¼ 0 otherwise ð2:9Þ ð ¥ ¥ ð ¥ ¥ dðx; yÞ dx dy ¼ 1 ð2:10Þ However, the most important property of the delta function is defined by its action under an integral sign, i.e. its so-called sifting property. The sifting theorem states that ð ¥ ¥ f ðxÞdðxx0Þ dx ¼ f ðx0Þ 1-D case ð ¥ ¥ ð ¥ ¥ f ðx; yÞdðxx0; yy0Þ dx dy ¼ f ðx0; y0Þ 2-D case ð2:11Þ This means that, whenever the delta function appears inside an integral, the result is equal to the remaining part of the integrand evaluated at those precise coordinates for which the delta function is nonzero. In summary, the delta function is formally defined by its three properties of singularity (Equation (2.6)), unit area (Equation (2.10)) and the sifting property (Equation (2.11)). Delta functions are widely used in optics and image processing as idealized representa- tions of point and line sources (or apertures): f ðx; yÞ ¼ dðxx0; yy0Þ ðpoint source located at x0; y0Þ f ðx; yÞ ¼ dðxx0Þ ðvertical line source located on the line x ¼ x0Þ f ðx; yÞ ¼ dðyy0Þ ðhorizontal line source located on the line y ¼ y0Þ f ðx; yÞ ¼ dðax þ by þ cÞ ðsource located on the straight line ax þ by þ cÞ ð2:12Þ 2.2 THE MATHEMATICS OF IMAGE FORMATION 27
  • 47. 2.2.5 The point-spread function The point-spread function of a system is defined as the response of the system to an input distribution consisting of a very small intensity point. In the limit that the point becomes infinitesimal in size, we can represent the input function as a Dirac delta function f ðx0 ; y0 Þ ¼ dðx0 x0; y0 y0Þ. For a linear system, we can substitute this into the linear superposition integral, Equation (2.3), to give gðx; yÞ ¼ Z Z dðx0 x0; y0 y0Þhðx; y; x0 ; y0 Þ dx0 dy0 ð2:13Þ By applying the sifting theorem of Equation (2.11) this gives a response gðx; yÞ to the point- like input as gðx; yÞ ¼ hðx; y; x0; y0Þ ð2:14Þ In other words, the response to the point-like input (sometimes termed the impulse response) is precisely equal to h. However, in the context of imaging, the weighting function in the superposition integral hðx; y; x0 ; y0 Þ is termed the point spread function or PSF because it measures the spread in output intensity response due to an infinitesimal (i.e. infinitely sharp) input point. Why, then, is the PSF an important measure? Consider for a moment that any input distribution may be considered to consist of a very large ( ! ¥) collection of very small ( ! infinitesimal) points of varying intensity. The PSF tells us what each of these points will look like in the output; so, through the linearity of the system, the output is given by the sum of the PSF responses. It is thus apparent that the PSF of such a linear imaging system (in the absence of noise) completely describes its imaging properties and, therefore, is of primary importance in specifying the behaviour of the system. It also follows from what we have said so far that an ideal imaging system would possess a PSF that exactly equalled the Dirac delta function for all combinations of the input and output coordinates (i.e. all valid combinations of the coordinates ðx; y; x0 ; y0 Þ). Such a system would map each infinitesimal point in the input distribution to a corresponding infinitesimal point in the output distribution. There would be no blurring or loss of detail and the image would be ‘perfect’. Actually, the fundamental physics of electromagnetic diffraction dictates that such an ideal system can never be achieved in practice, but it nonetheless remains a useful theoretical concept. By extension then, a good or ‘sharp’ imaging system will generally possess a narrow PSF, whereas a poor imaging system will have a broad PSF, which has the effect of considerably overlapping the output responses to neighbouring points in the input. This idea is illustrated in Figure 2.6, in which a group of points is successively imaged by systems with increasingly poor (i.e. broader) PSFs. Figure 2.6 The effect of the system PSF. As the PSF becomes increasingly broad, points in the original input distribution become broader and overlap 28 CH 2 FORMATION
  • 48. 2.2.6 Linear shift-invariant systems and the convolution integral So far in our presentation, we have assumed that the system PSF may depend on the absolute locations of the two points in the input and output domains. In other words, by writing the PSF as a function of four variables in Equation (2.3), we have explicitly allowed for the possibility that the response at, let us say, point x1; y1 in the output domain due to a point x0 1; y0 1 in the input domain may be quite different from that at some other output point x2; y2. If this were the case in practice for all pairs of input and output points, then specification of the system PSF would be a very cumbersome business. As an example, consider discretizing both the input and output domains into even a modest number of pixels such as 128 128. Since every pixel in the input can in principle contribute to every pixel in the output in a different way, we would then require 1284 268.4 million values to fully specify the system behaviour. Fortunately, most imaging systems (at least to a very good approximation) possess a property called shift invariance or isoplanatism. A shift-invariant system is characterized by a PSF that depends only on the difference between the coordinates in the input and output domains, not on their absolute values. Thus, a shift-invariant PSF in a 2-D imaging system has a functional form which makes it dependent not on four variables, but on two variables only: hðx; y; x0 ; y0 Þ ¼ hðx 00 ; y 00 Þ ¼ hðxx0 ; yy0 Þ ð2:15Þ Shift invariance has a simple physical interpretation. Consider a source point in the input domain at coordinates x0 ; y0 . If we move this source point to different locations in the input domain, changing the values of the coordinates x0 ; y0 , the corresponding response (i.e. its shape/functional form) in the output domain will remain the same but will simply be correspondingly translated in the output domain. In other words, shift the input and the corresponding output just shifts too. Figure 2.72 is a simulation of a photon-limited system in which photons in the input domain are randomly emitted and imaged by the linear shift- invariant system. This shows clearly how the image is built as the weighted superposition of shift-invariant responses to an increasing number of point-like inputs. When we have a shift-invariant system, the linear superposition integral Equation (2.3) reduces to a simpler and very important form – a convolution integral: gðx; yÞ ¼ ð ¥ ¥ ð ¥ ¥ f ðx0 ; y0 Þhðxx0 ; yy0 Þ dx0 dy0 ð2:16Þ Note that the infinite limits are used to indicate that the integration is to take place over all values for which the product of the functions is nonzero. The output gðx; yÞ is said to be given by the convolution of the input f ðx; yÞ with the PSF hðx; yÞ. Note that the corresponding form for convolution of 1-D functions follows naturally: gðxÞ ¼ ð ¥ ¥ f ðx0 Þhðxx0 Þ dx0 ð2:17Þ 2 The Matlab code which produced Figure 2.7 is available at http://www.fundipbook.com/materials/. 2.2 THE MATHEMATICS OF IMAGE FORMATION 29
  • 49. Convolution integrals are so important and common that they are often written in an abbreviated form: gðx; yÞ ¼ f ðx; yÞ hðx; yÞ ð2-DÞ gðxÞ ¼ f ðxÞ hðxÞ ð1-DÞ ð2:18Þ where the asterisks denote the operation of convolving the input function f with the system PSF h. In general, the function h in the convolution integrals above is called the kernel. 2.2.7 Convolution: its importance and meaning It would be hard to overstate the importance of convolution in imaging. There are two main reasons: (1) A very large number of image formation processes (and, in fact, measurement procedures in general) are well described by the process of convolution. In fact, if a system is both linear and shift invariant, then image formation is necessarily described by convolution. (2) The convolution theorem (which we will discuss shortly) enables us to visualize and understand the convolution process in the spatial frequency domain. This equiva- lent frequency-domain formulation provides a very powerful mathematical frame- work to deepen understanding of both image formation and processing. This framework will be developed in Chapter 5 and also forms a major part of Chapter 6. Figure 2.7 Each image in the top row shows arbitrary points in the input domain (increasing in number from left to right) whilst the images in the bottom row show the response of a LSI system to the corresponding input. The final image at the bottom right consists of a weighted superposition of responses to the input points, each of which has a similar mathematical shape or form 30 CH 2 FORMATION
  • 50. First, let us try to understand the mechanism of the convolution process. A convolution integral is a type of ‘overlap’ integral, and Figure 2.8 gives a graphical representation of how convolutions occur and are calculated. Basically, a flipped version of one of the functions is systematically displaced and the integral of their product (the overlap area) is calculated at each shift position. All shift coordinates for which the overlap area is nonzero define the range of the convolution. We might well still ask, but why then is the physical process of forming an image so often described by convolution? This is perhaps best understood through a simple example (see Figure 2.9a–c). Gamma rays are too energetic to be focused, so that the very earliest gamma ray detectors used in diagnostic radionuclide imaging consisted of a gamma-ray-sensitive scintillation crystal encapsulated by a thick lead collimator with a finite-size aperture to allow normally incident gamma photons to strike and be absorbed in the crystal. The scan was acquired by raster-scanning with uniform speed over the patient; in this way, the derived signal is thus proportional to the gamma activity emanating from that region of the body lying beneath the aperture. Note that a finite-size aperture is absolutely necessary because reducing the aperture size to an infinitesimal size would permit a vanishingly small fraction of emitted photons to actually reach the detector, which is clearly useless for diagnostic purposes. Let us first remind ourselves that, in general, the linear superposition integral allows for the possibility that every point in the input domain f ðx0 Þ may in principle contribute to the detector response at a chosen point x and does this through the PSF hðx; x0 Þ; thus, we have quite generally that gðxÞ ¼ Ð f ðx0 Þhðx; x0 Þ dx0 . Consider then Figure 2.9a, where for Figure 2.8 The calculation of a 1-D convolution integral 2.2 THE MATHEMATICS OF IMAGE FORMATION 31
  • 51. Detector (delta-like) Scanning pinhole (delta-like) (a) 1-D intensity profile δ (x′) f (x′) x′ x g(x) g(x) = f (x′) h (x ,x′)dx′ = f (x′) δ (x –x′)dx′ = f (x) 冕 冕 Detector (delta-like) Scanning pinhole (finite aperture) (b) 1-D intensity profile h (x′) f (x′) x′ x g(x) g(x) = f (x′) h (x ,x′)dx′ = f (x′) h (x –x′)dx′ 冕 冕 Detector (finite size) Scanning pinhole (finite aperture) (c) 1-D intensity profile h (x′) I (x) hd (x′) f (x′) x′ x I (x) = g (x′) hd (x ,x′)dx′ I (x) = f (x′) *h (x ,)*hd (x) g (x) = f (x′) δ (x –x′)dx′ 冕 冕 where Figure 2.9 (a) A delta like detector views a source intensity profile through a delta-like scanning pinhole. The resulting image is a convolution of the source with the pinhole PSF. In principle, this replicates the source profile so that gðxÞ ¼ f ðxÞ but this idealized response can never describe a real system. (b) Here, a delta like detector views a source intensity profile through a finite-size scanning pinhole. The resulting image is a convolution of the source with the pinhole PSF. All real systems exhibit such finite aperture effects. (c) A finite-size detector viewing a source intensity profile through a finite scanning pinhole. The resulting image is a convolution of the source intensity with both the pinhole and detector PSFs. In general, if N LSI elements are involved in the image formation process, the resulting image is described by convolving the source with each corresponding PSF 32 CH 2 FORMATION
  • 52. simplicity, we depict a 1-D detector and a 1-D intensity source. The idealized pinhole aperture may be approximated by a delta function dðx0 Þ. It is readily apparent that, if the detector were kept stationary but the pinhole aperture scanned along the x0 axis, we would only get a nonzero detector response gðxÞ at the detector when the shift coordinate x ¼ x0 . This situation is thus described by the linear superposition gðxÞ ¼ Ð f ðx0 Þdðxx0 Þ dx0 .3 If we now consider a finite pinhole aperture, as in Figure 2.9b, it is clear that many points in the input domain will now contribute to the detector response gðxÞ but some will not. In fact, it is clear that only those points in the input domain for which the difference xx0 lies below a certain threshold can contribute. Note that the PSF of this scanning aperture is determined by pure geometry and the detector response is thus independent of the absolute position x0 of the aperture – the dependence on x0 comes only as a result of how the input f ðx0 Þ changes. Finally, consider Figure 2.9c. Here, we depict a finite detector aperture as well as a finite scanning aperture, and this results in a more complicated situation. However, this situation is simply described by an additional further convolution such that the actual recorded intensity at the finite detector is now given by IðxÞ ¼ Ð gðx0 Þhdðxx0 Þ dx0 , where gðx0 Þ is the intensity at some point on the detector and hdðx0 Þ is the detector response (PSF). The way to understand this situation is depicted in Figure 2.10. Essentially, we break it down into two parts, first calculating the resulting intensity Contribution dI to the total intensity over the detector at point x′ is the product of the incident intensity g and the response at that point h The total recorded intensity is the sum of all such contributions over the detector- Detector x′ x hd (x′) hd (x – x′) I (x) = 冕dI = 冕g(x′) h (x – x′) dx′ dI = g (x′) h (x –x′) –∞ ∞ Figure 2.10 The response of a finite detector with response function hdðxÞ to an incident intensity field gðxÞ is given by their convolution. We consider the contribution to the total intensity recorded by the detector at some ordinate x0 when the detector is displaced by some amount x. This is dI ¼ gðx0 Þhdðx x0 Þ. By integrating all such contributions over the detector surface we obtain the convolution integral 3 Strictly, this supposes that the effective sensitive area of the detector is infinitesimal and thus also well approximated by a delta response this will occur either because it is infinitesimally small or because the scanning aperture lies very close to it. 2.2 THE MATHEMATICS OF IMAGE FORMATION 33
  • 53. at a fixed point on the detector and then considering how all such contributions make up the final recorded intensity. Referring to Figure 2.10, the detector has a response hdðx0 Þ when referred to the origin. We are interested in the total intensity recorded by this detector IðxÞ when it is displaced some distance x from the origin. The contribution to the recorded intensity dI at some precise point with ordinate x0 is given by the product of the incident intensity at that point gðx0 Þ times the shifted response hdðxx0 Þ – thus dI ¼ gðx0 Þhdðxx0 Þ. The total recorded intensity at the detector is thus given by all such contributions dI for which the ordinate x0 lies within the dimensions of the detector dimension (i.e. for which dI ¼ gðx0 Þhdðxx0 Þ 6¼ 0. Thus, we obtain IðxÞ ¼ Ð dI ¼ Ð ¥ ¥ gðx0 Þhdðxx0 Þ dx0 . 2.2.8 Multiple convolution: N imaging elements in a linear shift-invariant system In Figure 2.9c we effectively have an imaging system in which two aperture functions describe the imaging properties: hðxÞ and hdðxÞ. Under these circumstances, we have seen that the recorded intensity IðxÞ is given by successive convolutions of the input f ðxÞ with the PSF of the scanning aperture hðxÞ and the PSF of the detector hdðxÞ. Symbolically, we denote this by IðxÞ ¼ f ðxÞ hðxÞ hdðxÞ. Provided the assumption of linearity and shift invariance remains valid, this result extends naturallyto an arbitrary system of Nimaging elements (e.g. a sequence of lenses in an optical imaging system). Thus, in general, any processing sequence in which N linear and shift-invariant system elements act upon the input is described by a sequence of N convolutions of the input with the respective PSFs of the elements. This is summarized in Figure 2.11. 2.2.9 Digital convolution In digital image processing, signals are discrete not continuous. Under these conditions, convolution of two functions is achieved by discretizing the convolution integral. In the simple 1-D case, this becomes PSF 1 PSF 2 PSF N Output Input h1 (x) h2 (x) hn (x) g (x) = f (x)* h1 (x)* h2 (x)...*h2 (x) g (x) f (x) Figure 2.11 The output of an LSI system characterized by N components each having a PSF hiðxÞ is the repeated convolution of the input with each PSF 34 CH 2 FORMATION
  • 54. gj ¼ X i fihj i ð2:19Þ where the indices j and i correspond to discrete values of x and x0 respectively. In two dimensions, the discrete convolution integral may be written as gkl ¼ X j X i fijhk i;l j ð2:20Þ where the indices k and l correspond to x and y and i and j correspond to x0 and y0 . This equation somewhat belies the simplicity of the mechanism involved. The filter kernel h is only nonzero when both the shift coordinates k i and l j are small enough to lie within the spatial extent of h (i.e. are nonzero). For this reason, although the image fij has a large spatial extent, the filter kernel hk i;l j, when it corresponds to a PSF, is typically of much smaller spatial extent. The convolved or filtered function is thus given by a weighted combination of all those pixels that lie beneath the filter kernel (see Figure 2.12). A simple example of 1-D discrete convolution in Matlab is given in Example 2.1 and some simple examples of 2-D convolution using Matlab are given in Example 2.2. Note that 2-D convolution of two functions that are both of large spatial extent is much more computa- tionally efficient when carried out in the Fourier domain. We will discuss this when we introduce the convolution theorem later in Chapter 5. Figures 2.13 and 2.14 result from the code in Examples 2.1 and 2.2. 12 –1 –1 –1 –1 –1 –1 –1 w1 w2 w3 w4 w5 w6 w7 w8 w9 = 8 –1 10 32 40 41 42 12 Image = (–1x10) + (–1x11) + (–1x8) + (–1x40) + (8x35) fi = ∑ wkIk (i) + (–1x42) + (–1x38) + (–1x36) + (–1x46) = 14 10 40 38 89 39 13 11 35 36 39 43 13 8 42 46 42 45 9 13 40 41 39 38 11 8 36 37 36 37 9 i–j Figure 2.12 Discrete convolution. The centre pixel of the kernel and the target pixel in the image are indicated by the dark grey shading. The kernel is ‘placed’ on the image so that the centre and target pixels match. The filtered value of the target pixel is then given by a linear combination of the neighbourhood pixels, the specific weights being determined by the kernel values. In this specific case the target pixel of original value 35 has a filtered value of 14 2.2 THE MATHEMATICS OF IMAGE FORMATION 35
  • 55. Example 2.2 Matlab code What is happening? A¼imread('trui.png'); %Read in image PSF¼ fspecial('gaussian',[5 5],2); %Define Gaussian convolution kernel h¼fspecial('motion',10,45); %Define motion filter B¼conv2(PSF,A); %Convolve image with convolution kernel C¼imfilter(A,h,'replicate'); %Convolve motion PSF using alternative function D¼conv2(A,A); %Self convolution motion blurred with original subplot(2,2,1),imshow(A); %Display original image subplot(2,2,2),imshow(B,[]); %Display filtered image subplot(2,2,3),imshow(C,[]); %Display filtered image subplot(2,2,4),imshow(D,[]); %Display convolution image with itself (autocorrln) Comments Matlab functions: conv2, imfilter. This example illustrates 2 D convolution. The first two examples show convolution of the image with a Gaussian kernel using two related Matlab functions. The final image shows the autocorrelation of the image given by the convolution of the function with itself. Example 2.1 Matlab code What is happening? f¼ones(64,1); f¼f./sum(f); %Define rectangle signal f and normalize g¼conv(f,f); g¼g./sum(g); %Convolve f with itself to give g and normalize h¼conv(g,g); h¼h./sum(h); %Convolve g with itself to give h and normalize j¼conv(h,h); j¼j./sum(j); %Convolve h with itself to give j and normalize subplot(2,2,1),plot(f,'k '); axis square; axis off; subplot(2,2,2),plot(g,‘k ’); axis square; axis off; subplot(2,2,3),plot(h,‘k ’); axis square; axis off; subplot(2,2,4),plot(j,‘k ’); axis square; axis off; Comments Matlab functions: conv. This example illustrates the repeated convolution of a 1 D uniform signal with itself. The resulting signal quickly approaches the form of the normal distribution, illustrating the central limit theorem of statistics. 36 CH 2 FORMATION
  • 56. 2.3 The engineering of image formation From our mathematical consideration of the image formation, we now briefly consider the engineering aspects of this process. It is not possible to consider every eventuality in this instance, but we instead limit ourselves to the most common and, hence, practical imaging scenarios. f (x) g (x) = f (x)* f (x) j (x) = g (x)*h (x) h(x) = g (x)*g (x) Figure 2.13 Repeated convolution of a 1-D rectangle signal. The output rapidly approaches the form of the normal distribution, illustrating the central limit theorem of statistics Figure 2.14 Top left: original image; top right: after convolution with Gaussian kernel; bottom left: after convolution with Gaussian kernel; bottom right: convolution of the image with itself 2.3 THE ENGINEERING OF IMAGE FORMATION 37
  • 57. 2.3.1 The camera In general, let us consider our imaging device to be a camera. A camera image of a conventional scene is essentially a projection of the 3-D world (i.e. the scene) to a 2-D representation (i.e. the image). The manner in which this 3-D to 2-D projection occurs is central to our ability to perform effective analysis on digital images. If we assume an object/scene is illuminated by a light source (possibly multiple sources), then some of the light will be reflected towards the camera and captured as a digital image. Assuming we have a conventional camera, the light reflected into the lens is imaged onto the camera image plane based on the camera projection model. The camera projection model transforms 3-D world coordinates ðX; Y; ZÞ to 2-D image coordinates ðx; yÞ on the image plane. The spatial quantization of the image plane projection into a discretized grid of pixels in turn transforms the 2-D image coordinate on the image plane to a pixel position ðc; rÞ. The majority of scene images we deal with will be captured using a perspective camera projection. Perspective projection: In general the perspective projection (Figure 2.15, right) can be stated as follows: x ¼ f X Z y ¼ f Y Z ð2:21Þ A position ðX; Y; ZÞ in the scene (depth Z) is imaged at position ðx; yÞ on the image plane determined by the focal length of the camera f (lens to image plane distance). The perspective projection has the following properties (illustrated in Figure 2.16): . Foreshortening The size of objects imaged is dependent on their distance from the viewer. Thus, objects farther away from the viewer appear smaller in the image. . Convergence Lines that are parallel in the scene appear to converge in the resulting image. This is known as perspective distortion, with the point(s) at which parallel lines meet termed the vanishing point(s) of the scene. Scene Co-ordinates Scene Co-ordinates Image Co-ordinates Image Co-ordinates Perspective Projection Model Parallel Projection Model Z X Y y Z f Y X Z x y x Figure 2.15 Camera projection models: perspective (left) and parallel/affine (right) 38 CH 2 FORMATION
  • 58. Tobemoreprecisethisisthepin-holeperspectiveprojectionmodel,asweassumeallthelight rays pass through a single point and, hence, the scene is inverted (horizontally and vertically) on the image plane (Figure 2.15, left). Realistically, we deploy a lens, which further complicates matters by introducing lens distortion (affecting f), but this optics-related topic is beyond the scope of this text. With a lens, the scene is still imaged upside down (and back to front), but this is generally dealt with by the camera and should be ignored for all applied purposes. It should be noted that the perspective projection is not easily invertible from an image alone – i.e. given 2-D image position ðx; yÞ and camera focal length f it is not possible to recover ðX; Y; ZÞ. However, given knowledge of ðX; YÞ in the scene (measured relative to the camera position), the recovery of position depth Z may become possible (subject to noise and distortion). Accurate ðX; YÞ positions, relative to the exact camera position, are, however, difficult to determine and rarely recorded at time of image capture. Orthographic projection: An alternative camera projection model to the perspective projection is the orthographic (or parallel) projection. This is used by some specialist imaging instruments; for instance, a flat-bed scanner produces an orthographic projection of a scanned document, a medical scanner produces an orthographic projection of the human body. The orthographic projection is simply denoted as x ¼ X y ¼ Y The orthographic projection is an affine transformation such that relative geometric relationships are maintained, as the scene to image plane projection is parallel. As such, the image features are not reversed (Figure 2.15, right), but notably all information relating to scene depth is lost. In an orthographic projection, size is independent of the distance from the viewer and parallel lines are preserved. The projection may have a scaling factor m such that x ¼ mX and y ¼ mY, but this relates to regular image zooming or reduction and maintains these properties. Images captured over a close range (i.e. short focal length, macro-scale photography) or of a planar target can often be assumed to have an orthographic camera projection because of the negligible effects of the perspective projec- tion over this range. In addition to the projection model, the camera has a number of other characteristics that determine the final image formed from the scene. Notably any camera is of fixed spatial Convergence of parallel lines Foreshortening Vanishing Point Figure 2.16 Effects of the perspective projection model on scene geometry in the image 2.3 THE ENGINEERING OF IMAGE FORMATION 39