1
Digital Image Processing and
Applications
COEP Technological University
09/01/2023
Unit 1: Contents
• Introduction to Digital Image Processing
– Introduction to Digital Image and different types of images
– State of the art examples of digital image processing
– Key stages in digital image processing
– Representing image in different formats
– Different color spaces
– Relationship between pixels
• Mathematical operations on digital image
– Operations on Image- Arithmetic and Logical operations
• Hands on session
09/01/2023 COEP Technological University 3
What is a Digital Image?
•A digital image is a representation of a two-dimensional image as a finite set of digital
values, called picture elements or pixels.
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
•Image is represented by f(x, y); x and y are the spatial coordinates
–Intensity or gray level of an image: amplitude of f at any pair of coordinates (x, y)
•When x, y, and the amplitude values of f are all finite, discrete quantities, we call the image a
digital image.
•Pixel values typically represent gray levels, colours, heights, opacities etc
• Digitization implies that a digital image is an approximation of a real scene
1 pixel
What is Digital Image Processing?
•The field of Digital Image Processing refers to processing
digital images by means of a digital computer
•Digital image processing motivated by
– Improvement of pictorial information for human interpretation
– Processing of image data for efficient storage and transmission
– representation for autonomous machine perception
What is DIP? (cont…)
The continuum from image processing to computer vision can be
broken up into low-, mid- and high-level processes
Low Level Process Mid Level Process High Level Process
Input: Image Input: Image Input: Attributes
Output: Image Output: Attributes Output: Understanding
Examples: Noise Examples: Object Examples: Scene
removal, image recognition, understanding,
sharpening segmentation autonomous navigation
Applications of DIP
The use of digital image processing techniques has
exploded and they are now used for all kinds of tasks in
all kinds of areas
– Image enhancement/restoration
– Artistic effects
– Medical visualisation
– Industrial inspection
– Law enforcement
– Human computer interfaces
Examples: Image Enhancement
One of the most common uses of DIP techniques:
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
improve quality, remove noise etc
Examples: The Hubble Telescope
•Launched in 1990 the Hubble telescope can take images of very
distant objects.
•However, an incorrect mirror made many of Hubble’s
images useless.
•Image processing techniques were used to fix this.
Examples: Artistic Effects
Artistic effects are used
to make images more
visually appealing, to
add special effects and to
make composite images
Examples: Medicine
Take slice from MRI scan of canine heart, and find
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
boundaries between types of tissue
– Image with gray levels representing tissue density
– Use a suitable filter to highlight edges
Original MRI Image of a Dog Heart Edge Detection Image
Examples: GIS
Geographic Information Systems
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
– Digital image processing techniques are used extensively to
manipulate satellite imagery
– Terrain classification
– Meteorology
Examples: Industrial Inspection
•Human operators are expensive,
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
slow and unreliable.
•Make machines do the
job instead
•Industrial vision systems
are used in all kinds of industries
Examples: PCB Inspection
Printed Circuit Board (PCB) inspection
– Machine inspection is used to determine that all components are present and
that all solder joints are acceptable
– Both conventional imaging and x-ray imaging are used
Examples: Law Enforcement
Image processing techniques
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
are used extensively by law
enforcers
• Number plate recognition for
speed cameras/automated toll
systems
• Fingerprint recognition
• Enhancement of CCTV images
Examples: HCI
Try to make human computer interfaces more natural
– Face recognition
– Gesture recognition
A simple image formation model
• Intensity values are proportional
to energy radiated by a physical
source
• 0 < f(x,y) < ∞
• The function f(x, y) may be
characterized by two
components:
the amount of source illumination
incident on the scene being
viewed : Illumination i(x,y)
the amount of illumination
reflected by the objects in the
• The two functions combine as a product to form f(x, y):
scene: reflectance r(x, y)
f(x, y) = i(x, y) r(x, y);
0<i(x,y)<∞ and 0<r(x,y)<1
Contd…
l = f(x0 , y0 );
where l is the intensity (gray level) of a monochrome
image at any coordinates (x0, y0)
Lmin< l < Lmax
This interval is shifted to the interval [0, L-1];
where l = 0 Black
and l = L-1 considered
Digital Images
• Samples = pixels
• Quantization = number of bits per pixel
• Example: if we would sample and quantize standard TV
picture (525 lines) by using VGA (Video Graphics Array),
video controller creates matrix 640x480pixels, and each pixel
is represented by 8 bit integer (256 discrete gray levels)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Image Sampling And Quantisation
Spatial Resolution
Spatial resolution can be defined as the number of
independent pixels values per inch.
Measuring spatial resolution
Since the spatial resolution refers to clarity, so for different devices,
different measures are used.
Dots per inch: Dots per inch or DPI is usually used in monitors.
Lines per inch: Lines per inch or LPI is usually used in laser
printers.
Pixel per inch: Pixel per inch or PPI is measure for different
devices such as tablets , Mobile phones e.t.c.
Spatial Resolution
The spatial resolution of an image is determined by how
sampling was carried out
Spatial resolution simply refers to the smallest
discernable detail in an image
– Vision specialists will
often talk about pixel
size
– Graphic designers will
talk about dots per 5.1
inch (DPI) e g apix
M
els
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Spatial Resolution (cont…)
Spatial Resolution (cont…)
1024 * 1024 512 * 512 256 * 256
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
128 * 128 64 * 64 32 * 32
Intensity Level Resolution
Intensity level resolution refers to the number of
intensity levels used to represent the image
– The more intensity levels used, the finer the level of detail discernable
in an image
– Intensity level resolution is usually given in terms of the number of bits
used to store each intensity level
Number of Intensity
Number of Bits Examples
Levels
1 2 0, 1
2 4 00, 01, 10, 11
4 16 0000, 0101, 1111
8 256 00110011, 01010101
16 65,536 1010101010101010
Intensity Level Resolution (cont…)
256 grey levels (8 bits per pixel) 128 grey levels (7 bpp) 64 grey levels (6 bpp) 32 grey levels (5 bpp)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
16 grey levels (4 bpp) 8 grey levels (3 bpp) 4 grey levels (2 bpp) 2 grey levels (1 bpp)
Intensity resolution and bit depth
Smallest discernible change in the intensity level
Types of Images
Based on Attributes
• Raster graphics –pixel based
Image formats:
– BMP ,GIF,JPEG,PNG
• Vector graphics –use basic geometric attributes
Image formats
-SVG, EPS, PDF
Based on Colour
• Binary 1 bit per pixel
• Grayscale 1 sample per point
• RGB 3 samples per point
• RGBA 4 samples per point (Red, Green,
Blue, and “Alpha”, a.k.a. Opacity)
Colour images
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Color Spaces:
They provide a way to identify colors
that is more intuitive
The various color spaces exist because
they present color information in ways
that make certain calculations more
convenient
For example, the RGB color space
defines a color as the percentages of
red, green, and blue hues mixed
together.
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Colour images
Key Stages in Digital Image Processing
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Image Aquisition
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Image Enhancement
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Image Restoration
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Morphological Processing
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Segmentation
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Object Recognition
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Representation & Description
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Image Compression
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Key Stages in Digital Image Processing:
Colour Image Processing
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Summary
We have looked at:
– What is a digital image?
– What is digital image processing?
– State of the art examples of digital image processing
– Key stages in digital image processing
Basic Relationships between pixels
Neighbors of pixel
Neighbors of pixel contd.
Neighbors of pixel contd.
Connectivity/ Adjacency
09/01/2023 COEP Technological University 47
Adjacency
09/01/2023 COEP Technological University 48
Adjacency
09/01/2023 COEP Technological University 49
Adjacency
09/01/2023 COEP Technological University 50
Connectivity
09/01/2023 COEP Technological University 51
Distance
09/01/2023 COEP Technological University 52
Distance contd.
09/01/2023 COEP Technological University 53
Distance contd.
09/01/2023 COEP Technological University 54
Distance measures
09/01/2023 COEP Technological University 55
Distance measures
09/01/2023 COEP Technological University 56
Mathematical Tools used in Digital Image
Processing
09/01/2023 COEP Technological University 57
Array versus Matrix Operations
Arithmetic and Logic Operations
• Arithmetic and logic operations are often applied as
preprocessing steps in image analysis in order to combine images
in various way.
• Addition, subtraction comprise the arithmetic operation, while
AND , OR, and NOT make up the logic operations.
• These operations are performed on two images , except the NOT
logic operation which require only one image, and are done on a
pixel by pixel basis.
09/01/2023 COEP Technological University 59
Image Addition Examples: This example shows one step in the image
morphing process where an increasing percentage of the second image is slowly added
to the first, and a geometric transformation is usually required to align the images. a)
first original, b) second original, c) addition of images (a) and (b). This example
shows adding noise to an image which is often useful for developing image restoration
models. d) original image, e) Gaussian noise, variance = 400, mean = 0, f) addition of
images (d) and (e).
a) b) c)
d) e) f)
09/01/2023 COEP Technological University 60
Subtraction
• Subtraction of two image is often used to detect motion.
• Consider the case where nothing has changed in a scene;
the image resulting from subtraction of two sequential
image is filled with zeros - a black image.
• If something has moved in the scene, subtraction
produces a nonzero result at the location of movement.
09/01/2023 COEP Technological University 61
a) b)
c) d)
e) f)
Image Subtraction:a) Original scene, b) same scene later, c) subtraction of scene a from
scene b, d) the subtracted image with a threshold of 50, e) the subtracted image with a threshold
of 100, f) the subtracted image with a threshold of 150. Theoretically, only image elements that
have moved should show up in the resultant image. Due to imperfect alignment between the two
images, other artifacts appear. Additionally, if an object that has moved is similar in brightness
to the09/01/2023
background it will cause problems
COEP–Technological
in this example
Universitythe brightness of the car is similar
62 to
the grass.
• Medical imaging often uses this type of operation to
allow the doctor to more readily see changes which
are helpful in the diagnosis.
• The technique is also used in law enforcement and
military applications; for example, to find an
individual in a crowd or to detect changes in a
military installation.
09/01/2023 COEP Technological University 63
Logic operations
• The logic operations AND, 0R and NOT operate in a bit-wise
fashion on pixel data.
• Example:
– performing a logic AND on two images. Two corresponding
pixel values are 11110 in one image and 8810 in the second
image. The corresponding bit string are:
11110 = 011011112
8810 = 010110002
01101111 2
AND 01011000 2
010010002
09/01/2023 COEP Technological University 64
• The Iogic operations AND and OR are used to
combine the information in two images.
• This may be done for special effects but a more
useful application for image analysis is to perform a
masking operation.
• AND and OR can be used as a simple method to
extract a ROI from an image.
09/01/2023 COEP Technological University 65
Image Masking: a) Original image, b) image mask for AND operation, c) Resulting image
from (a) AND (b), d) image mask for OR operation, created by performing a NOT on mask (b), e)
Resulting image from (a) OR (d).
a) b) c)
09/01/2023 COEP Technological University e) 66
d)
Complement Image –NOT Operation
09/01/2023
a) COEP Technological University b) 67