Dr Mai Kamal DIP 2022 1
By
Lecturer, Computer Science Department,
Faculty of Computers and Artificial Intelligence,
Benha University
Dr Mai Kamal DIP 2022 2
Digital Iamge Processing Course
Dr Mai Kamal DIP 2022 3
Digital Iamge Processing
Course
Teams Link
https://teams.microsoft.com/l/team/19%3aV89kJ8amsbE3ssF9V0x
mGOukoYKvZIwPVey1-
EUiL4Y1%40thread.tacv2/conversations?groupId=47e1fe88-6e6b-
433e-b771-94c21eeb96c6&tenantId=ff4a48d6-4b5e-4fd3-8266-
7eafc3e6e23e
Dr Mai Kamal DIP 2022 4
Grading Formula
Weights of the Assessments
Final Term Examination 50
Midterm Exam 15
Practical Exam 15
Quiz 1 5
Quiz 2 5
Semester Work 10
Dr Mai Kamal DIP 2022 5
Text Book
R. Gonzalez, R. Woods.
Digital Ιmage Processing,
Prentice Hall, 2008.
Third Edition .
Dr Mai Kamal DIP 2022 6
Digital Image Fundamentals
Dr Mai Kamal DIP 2022 7
History…………
Dr Mai Kamal DIP 2022 8
The First Photo
Bidwell built two machines, a transmitter and a
receiver. Then he painted two simple
pictures—black and white silhouettes of a
butterfly and a horse.
Dr Mai Kamal DIP 2022 9
First Digital Photograph
Then in 1957, Russell Kirsch converted a
photograph of his three-month-old son into a
tiny digital file using an early computer.
Dr Mai Kamal DIP 2022 10
History of DIP (cont…)
1970s: Digital image processing begins to
be used in medical applications.
– 1979: Sir Godfrey N.
Hounsfield & Prof. Allan M.
Cormack share the Nobel
Prize in medicine for the
invention of tomography,
the technology behind
Computerised Axial
Typical head slice CAT image
Tomography (CAT) scans
Dr Mai Kamal DIP 2022 14
History of DIP (cont…)
1980s : 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
Dr Mai Kamal DIP 2022 15
Imaging Types
Gamma Ray Imaging(Nuclear Medicine).
X-ray Imaging(Diagnosis).
Imaging in Ultrviolet band(industrial inspection,
astronomical observation).
Imaging in Visible & Infra Red band.
Imaging in Microwave band.
The dominant application of imaging in the microwave band is wave
The unique feature of imaging radar is its ability to collect data over virtually any region at anytime, regardless of
weather or ambient lighting condition
Imaging in Radio band.
Imaging Modeleties using non EM Spectrum band.
Dr Mai Kamal DIP 2022 16
Examples: Image Enhancement
One of the most common uses of DIP
techniques: improve quality, remove noise etc
Dr Mai Kamal DIP 2022 17
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.
Dr Mai Kamal DIP 2022 18
Examples: Artistic Effects
Artistic effects are
used to make images
more visually
appealing, to add
special effects and to
make composite
images.
Dr Mai Kamal DIP 2022 19
Examples: Medicine
Take slice from MRI scan of canine heart,
and find 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
Dr Mai Kamal DIP 2022 20
Examples: GIS
Geographic Information Systems
– Digital image processing techniques are used
extensively to manipulate satellite imagery
– Terrain classification
– Meteorology
Dr Mai Kamal DIP 2022 21
Examples: GIS (cont…)
Night-Time Lights of
the World data set
– Global inventory of
human settlement
– Not hard to imagine the
kind of analysis that
might be done using this
data
Dr Mai Kamal DIP 2022 22
Examples: Industrial
Inspection
Human operators are
expensive, slow and
unreliable.
Make machines do the
job instead.
Industrial vision systems
are used in all kinds of
industries.
Dr Mai Kamal DIP 2022 23
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.
Dr Mai Kamal DIP 2022 24
Examples: Law Enforcement
Image processing
techniques are used
extensively by law
enforcers
– Number plate recognition
for speed
cameras/automated toll
systems.
– Enhancement of CCTV
images.
– Fingerprint recognition.
Dr Mai Kamal DIP 2022 25
Examples: HCI
Try to make human computer interfaces
more natural:
• Face recognition
• Gesture recognition
Dr Mai Kamal DIP 2022 26
SOURCES OF IMAGES
Dr Mai Kamal DIP 2022 27
Color Fundamentals
Light: just a particular part of electromagnetic (EM)
spectrum that can be sensed by the human eye.
The electromagnetic spectrum(EM) is split up
according to the wavelengths of different forms of
energy.
Chromatic light spans the EM from approximately
400 to 700 nm.
Dr Mai Kamal DIP 2022 28
Sources of Digital Images
The principal source for the images is the
electromagnetic (EM) energy spectrum.
Images can be made from any form of EM radiation.
Sources of Digital Images
Gamma Rays
The major uses of imaging based on gamma rays
include nuclear medicine.
Images are produced from the emission collected
by gamma ray detectors.
Sources of Digital Images
Gamma Rays
Gamma-Ray imaging of
A starburst galaxy about
12 million light-years
away
Gamma-Ray
Imaging
Cherenkov
Telescope
Gamma-Ray Imaging
İn nuclear medicine
Sources of Digital Images
X-rays
The best Known use of x-ray is medical
diagnostics, but they are used extensively
industry of other areas, like security applications.
Sources of Digital Images
X-rays
X-ray images from the space
The Chandra X-Ray Observatory
Chest X-ray - Aortic angiogram – Head CT
Circuit boards – Cygnus Loop
Sources of Digital Images
Ultra-violet
Imaging in the Ultraviolet Band
application of UV light include.
industrial inspection, microscopy,
laser, biological imaging,
astronomical observation.
Sources of Digital Images
Ultra-violet
Normal corn
Smut corn
Cygnus Loop
Sources of Digital Images
Infrared
Sources of Digital Images
Infrared
infrared ("thermal") image Snake around the arm
Messier 51 in ultraviolet (GALEX), visible (DSS), and near
infrared (2MASS). Courtesy of James Fanson.
Sources of Digital Images
Microwaves
The dominant applications of imaging in the
microwave band is radar the unique feature of
imaging radar is its ability to collect data virtually
over any region at any time regardless of weather
or ambient lighting conditions.
Sources of Digital Images
Microwaves
Used in radar detection
applications
Spaceborne radar image of mountains
(NASA)
Synthetic Aperture Radar
System
Sources of Digital Images
Radio Waves
The major applications of imaging in the radio
band are in medicine and astronomy in
medicine, radio waves are used in MRI.
Sources of Digital Images
Radio Waves
MRI image slices from the brain
Sources of Digital Images
Ultrasound Imaging
Ultrasonic spectrum
Ultrasonic Baby image Ultrasound image
during pragnancy acquisition device
Sources of Digital Images
Visible Light
Sources of Digital Images
Visible Light
R
G B
Digital Images based on the EM
Spectrum
An example showing Imaging in all of the bands
Visible light
STAGES OF DIGITAL IMAGE
PROCESSING
Dr Mai Kamal DIP 2022 46
What are the steps in image
processing?
Step 1: Image Acquisition. The image is
captured by a sensor…
Step 2: Image Enhancement. …
Step 3: Image Restoration. …
Step 4: Color Image Processing. …
Step 5: Wavelets. …
Step 6: Compression. …
Step 7: Morphological Processing. …
Step 8: Image Segmentation.
Dr Mai Kamal DIP 2022 47
Fundamental Steps in DIP
Material covered in book has two broad categories
• Methods having input & Output as images.
• Methods having image as input and attributes as output
Dr Mai Kamal DIP 2022 48
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
Dr Mai Kamal DIP 2022 49
Key Stages in Digital Image
Processing:
Image Acquisition
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Dr Mai Kamal DIP 2022 50
Key Stages in Digital Image
Processing:
Image Enhancement
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Dr Mai Kamal DIP 2022 51
Key Stages in Digital Image
Processing:
Image Restoration
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Dr Mai Kamal DIP 2022 52
Key Stages in Digital Image
Processing:
Morphological Processing
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Dr Mai Kamal DIP 2022 53
Key Stages in Digital Image
Processing:
Image Segmentation
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Dr Mai Kamal DIP 2022 54
Key Stages in Digital Image
Processing:
Object Recognition
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Dr Mai Kamal DIP 2022 55
Key Stages in Digital Image
Processing:
Representation & Description
Image Morphological
Restoration Processing
Image
Segmentation
Enhancement
Image Object
Acquisition Recognition
Representation
Problem Domain
& Description
Colour Image Image
Processing Compression
Dr Mai Kamal DIP 2022 56
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
Dr Mai Kamal DIP 2022 57
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
Dr Mai Kamal DIP 2022 58
Components of Image Processing
System
The basic components comprising a typical general-
purpose system used for digital image processing.
Dr Mai Kamal DIP 2022 59
Elements of Digital Image
Processing Systems
Dr Mai Kamal DIP 2022 60
HUMAN EYE VS CAMERA
Dr Mai Kamal DIP 2022 61
Human Visual System
Dr Mai Kamal DIP 2022 62
Human Visual System
The image is formed on the retina, can help us with
processing digital images.
Dr Mai Kamal DIP 2022 63
Human Visual System
Components of eyes:
◾ The lens focuses light from objects onto the retina
◾ The retina is covered with light
receptors called cones and rods.
◾ Cones are concentrated at the
central portion of the retina and
high sensitive to color.
◾ Cones is in the number about
6 to 7 million.
Dr Mai Kamal DIP 2022 64
Human Visual System
Components of eyes:
◾ The lens focuses light from objects onto the retina
◾ The retina is covered with light
receptors called cones and rods.
◾ Rods very much in number
from 75 to 150 million.
◾ Rods are distributed at retina
surface and are sensitive to low
levels of illumination
Dr Mai Kamal DIP 2022 65
Image Formation in the Eye
The colors humans perceive are determined by nature
of light reflected from an object.
For example, if white light (contains all wavelengths)
is shone onto green object it absorbs most wavelengths
absorbed except green wavelength (color).
Dr Mai Kamal DIP 2022 66
Image Formation in the Eye
Light: Source light.
The total energy from the light source, including heat
and all electromagnetic radiation, is called radiance.
Luminance is a measure of the light strength that is
actually perceived by the human eye.
Dr Mai Kamal DIP 2022 67
Image Formation in the Eye
Radiance is a measure of the total output of the source.
The brightness or apparent brightness of an object is
the perceived luminance and depends on the luminance
of the surround. Brightness is a subjective,
psychological measure of perceived intensity.
Dr Mai Kamal DIP 2022 68
Image Formation in the Eye
Dr Mai Kamal DIP 2022 69
Human Eye vs Camera
In human eye, Muscles within the eye can be used to
change the shape of the lens allowing us focus on
objects that are near or far away.
In ordinary camera, the lens has a fixed focal length,
and focusing at various distances is achieved by
varying the distance between the lens and the image
plane.
Dr Mai Kamal DIP 2022 70
Image Perception
Image perception consists of two basic
steps:
capturing the image with the eye.
Recognizing and interpreting the image with
visual cortex in the brain.
Dr Mai Kamal DIP 2022 71
Image Acquisition
FIRST PHASE
72
Dr Mai Kamal DIP 2022
What is an Image
An image is a visual representation of
something.
A digital image is a binary representation of
visual data.
These images can take the form of
photographs, graphics and individual video
frames.
For this purpose, an image is a picture that was
created or copied and stored in electronic form.
Dr Mai Kamal DIP 2022 73
Image Acquisition
In image processing, image acquisition is an action of
retrieving image from an external source for further processing.
Image acquisition is the first step in image processing. This step
is also known as preprocessing in image processing. It involves
retrieving the image from a source, usually a hardware-based
source.
The image acquisition is the process of capturing an
unprocessed image from the scene by an optical device.
It’s always the foundation step, no process is available before
obtaining an image.
1 pixel
Dr Mai Kamal DIP 2022 74
Image Acquisition
Image are generated by the combination of illumination
source and reflection energy by the objects in the scene.
Image is illumination and reflection.
Dr Mai Kamal DIP 2022 75
Simple Image Acquisition
Model
Dr Mai Kamal DIP 2022 76
What is image in image
processing?
An Image is a spatial representation of a two
dimensional or three-dimensional scene.
An image defined in the "real world" is considered
to be a function of two real variables.
Dr Mai Kamal DIP 2022 77
What is an Image
A 2D function f (x,y) with f as the amplitude (e.g.
brightness) of the image at the real coordinate
position (x,y).
Amplitude of is called the intensity or gray level.
Dr Mai Kamal DIP 2022 78
What is an Image
f (x,y)= i (x,y) r(x,y)
Where, 0< i(x,y) <∞ and 0 < r(x,y) <1 .
i (x,y) is the amount of the source illumination incident
on the scene being viewed.
r(x,y) is the amount of the source illumination reflected
back by the objects in the scene.(if=0 totally absorption, if=1
totally reflectance).
Dr Mai Kamal DIP 2022 79
What is an Image
Image is an array or a matrix pixel (picture elements)
arranged in columns and rows.
The 2D continuous image f(x,y) is divided into N
rows and M columns.
The intersection of a row and a column is called as
pixel (Picture element /
image element).
Dr Mai Kamal DIP 2022 80
Image Pixels
Image is a grid of squares, each of which
contains a single color (called pixel).
This pixel is a point on the image that takes on
a specific shade, opacity or color.
Dr Mai Kamal DIP 2022 81
What is Intensity in Image
Processing?
Each point at every (x , y) is called amplitude or
intensity of an image.
Intensity refers to the amount of light.
For grayscale images, it’s depicted by the grey
level value at each pixel (e.g., 127 is darker than
220 and brighter than 055 for 8-bits coded images).
Dr Mai Kamal DIP 2022 82
Representing Digital Image
Images representation: to convert the input data to
a form suitable for computer processing.
Dr Mai Kamal DIP 2022 83
Representing Digital Image
The pixel is usually represented in one of the
following:
– Binary - Each pixel is just black or white.
– Grayscale - A pixel is an integer with a value
between 0 to 255 (0 is completely black and 255
is completely white).
– RGB - A pixel is made up of 3 integers between
0 to 255 (the integers represent the intensity of
red, green, and blue).
Dr Mai Kamal DIP 2022 84
TYPES OF DIGITAL IMAGES
Dr Mai Kamal DIP 2022 85
Types of Digital Images (
Binary Image )
Images that have only two unique values of pixel
intensity- 0 (representing black) and 1 (representing
white) are called binary images.
Each pixel is just black or white.
Need one bit per pixel.
It used in applications where the only information
required is general shape or outline, for example optical
character recognition (OCR).
Dr Mai Kamal DIP 2022 86
Types of Digital Images (
Binary Image )
Images for which a binary representation may be suitable
include text (printed or handwriting), fingerprints, or
architectural plans.
Binary Image is commonly used for image segmentation.
Dr Mai Kamal DIP 2022 87
Types of Digital Images ( Gray
Image)
Gray-scale images are referred to as monochrome (one-
A power of 2
color) images.
Grayscale or 8-bit images are composed of 256 unique
colors, where a pixel intensity of 0 represents the black
color and pixel intensity of 255 represents the white color.
All the other 254 values in between are the different
shades of gray.
Dr Mai Kamal DIP 2022 88
Types of Digital Images ( Gray
Image)
Pixel intensity value
Consider the following
image (2724x2336 pixels)
f(1,1) = 103 to be 2D function or a
matrix with rows and
Pixel location columns
In 8-bit representation
Pixel intensity values
rows columns change between 0 (Black)
and 255 (White)
f(645:650,1323:1328) =
83 82 82 82 82 82
82 82 82 81 81 81
82 82 81 81 80 80
82 82 81 80 80 79
80 79 78 77 77 77
80 79 78 78 77 77
f(2724,2336) = 88
Dr Mai Kamal DIP 2022 89
Types of Digital Images ( Gray
Image)
The number of bits used for each pixel determines the
number of different gray levels available.
In applications like medical imaging and astronomy, 12
or 16 bits/pixel images are used. These extra gray levels
become useful when a small section of the image is made
much larger to discern details.
Dr Mai Kamal DIP 2022 90
Types of Digital Images ( RGB
Image)
Dr Mai Kamal DIP 2022 91
Types of Digital Images ( RGB
Image)
Dr Mai Kamal DIP 2022 92
Types of Digital Images ( RGB
Image)
Remember digitization implies that a digital image is
an approximation of a real scene.
“RGB” represents the Red, Green, and Blue
“channels” of an image.
One pixel
Dr Mai Kamal DIP 2022 93
Types of Digital Images ( RGB
Image)
Dr Mai Kamal DIP 2022 94
Types of Digital Images ( RGB
Image)
The images we are used to in the modern world are RGB
or colored images.
This is a simple extension of the grey scale model where
each pixel is composed of three colors: red, green and
blue.
Each pixel has a particular color that described by the
amount of red, green and blue in it.
Dr Mai Kamal DIP 2022 95
Types of Digital Images ( RGB
Image)
RGB Image consists of three matrices: red, green and blue .
A pixel in an RGB image will be of color black when the pixel value is
(0, 0, 0) and
white when it is (255, 255, 255).
Any combination of numbers in between gives rise to all the different
colors existing in nature. For example, (255, 0, 0) is the color red (since
only the red channel is activated for this pixel). Similarly, (0, 255, 0) is
green and (0, 0, 255) is blue.
Dr Mai Kamal DIP 2022 96
RGBA Image
RGBA images are colored RGB images with an extra
channel known as “alpha” that depicts the opacity of
the RGB image. Opacity ranges from a value of 0% to
100% and is essentially a “see-through” property.
Opacity in physics depicts the amount of light that
passes through an object. For instance, cellophane
paper is transparent (100% opacity), frosted glass is
translucent, and wood is opaque. The alpha channel in
RGBA images tries to mimic this property.
Dr Mai Kamal DIP 2022 98
Types of Digital Images (
Indexed Image)
Image has an associated color map which is
simply a list of all the colors used in that image.
Each pixel has a value which does not give its
color (as for an RGB image), but an index to the
color in the map.
Dr Mai Kamal DIP 2022 99
Types of Digital Images (
Indexed Image)
color map is a list of all the colors used in that
image.
Without the color map the image would be very
dark and colorless.
Dr Mai Kamal DIP 2022 100
Next Lecture
LEC.3: FUNDAMENTALS IN
IMAGE PROCESSING
Dr Mai Kamal DIP 2022 101
Dr Mai Kamal DIP 2022 103