Chapter 1
Fundamentals of
Digital Image Processing
Dr. Archana Ekbote
Outline of the Chapter
❖ Human Visual System (Self-study) (Section 2.1: Gonzalez & Woods)
❖ Components of Image Processing
❖ Image Sensing & Acquisition
❖ Image Sampling & Quantization
❖ Basic Relationships Between Pixels
01
Components of Image Processing
02
Components of Image Processing
03
Components of Image Processing
❖ Image Sensors: It detect the intensity, amplitude,
coordinates, and other characteristics of images and send
the information to image processing hardware. It contains
the problem domain.
❖ Image Processing Hardware: It is the specialized
hardware used to process the image sensor instructions. It
sends the output to a general-purpose computer.
❖ Computer: It is the general-purpose computer.
❖ Image Processing Software: The software consists of
specialized modules that perform specific tasks.
02
Components of Image Processing
❖ Mass Storage: Need to store images during image
processing.
❖ Hard Copy Device: Once the image has been processed,
it is saved to a hard copy device. It might be a pen drive or
another type of external ROM device.
❖ Image Display: It includes the monitor or display screen
on which the processed images are shown.
❖ Network: Need for transmission of image data.
02
Image Sensing & Acquisition
02
Image Formation
SUN
02
Image Formation
02
Digital Image Acquisition Process
Ref. :- R. C. Gonzalez, and R. E. Woods, Digital Image Processing, Pearson
03
Image Sensors
❖ Incoming energy (illumination) is transformed into a
voltage/current signal.
❖ The output voltage/current is response of the sensor(s).
e.g. Photodiode, Photoresistor
❖ Sensor material is responsive to a particular type of
energy.
❖ Selection of sensor material depends on the application.
❖ Filters can be used to improve the selectivity.
04
Types of Image Sensors
Single Imaging
Sensor
Line Sensor
Array Sensor
Ref. :- R. C. Gonzalez, and R. E. Woods, Digital Image Processing, Pearson
05
Mathematical Modeling of Image
❖ It’s a 2-D function = f(x,y)
– x and y are special coordinates
– f is a positive scalar quantity
❖ Physical meaning of the value f is determined by
source/type of image.
– For Gray-scale (Monochromatic) Images f Luminance
– For Color Images f Luminance + Chrominance
06
Mathematical Modeling of Image contd…
❖ For image generated from physical process, its values
are proportional to the energy radiated by the physical
source f(x,y) must be nonzero and finite.
0 f ( x, y )
❖ The function f(x,y) is characterized by two components:
– Illumination : amount of source illumination incident on the
scene being viewed.
– Reflectance : amount of illumination reflected by the object in the
scene.
f ( x , y ) = i ( x, y ) r ( x, y )
Where, i(x,y) = function of illumination source 0 i ( x, y )
r(x,y) = function of imaged object 0 r ( x, y ) 1
07
Image Sampling & Quantization
08
Image Sampling & Quantization
Analog Sampling Discrete Quantization Digital
Image Image Image
❖ Sampling
– Converts infinite no. of image points to finite number of image
points
❖ Quantization
– Converts infinite no. of gray levels to finite no. of gray levels
09
Generating a Digital Image
Ref. :- R. C. Gonzalez, and R. E. Woods, Digital Image Processing, Pearson
10
Effect of Sampling & Quantization
❖ The quality of digital image (visual perception) depends
on Sampling & Quantization
Ref. :- R. C. Gonzalez, and R. E. Woods, Digital Image Processing, Pearson
11
Conventions used for representation of Digital Image
f (0,0) f (0,1) f (0, N − 1)
f (1,0) f (1,1) f (1, N − 1)
f ( x, y ) =
f ( M − 1,0) f ( M − 1,1) f ( M − 1, N − 1)
Ref. :- R. C. Gonzalez, and R. E. Woods, Digital Image Processing, Pearson
12
Conventions used for representation of Digital Image
– Dimensions of the image :MxN
– No. of bit per pixel (BPP) : k (per color channel)
– No. of gray levels : L = 2k
– Size of image : b = M x N x k (for gray scale)
b = M x N x 3 x k (for color image)
Q. Find the memory required to store 8-bit gray scale image
of size 1024×1024.
Q. Find the memory required to store 24-bit color image of
size 1024×1024.
13
Spatial Resolution
❖ Spatial Resolution
= smallest possible detail in an image
= number of samples (pixels) per unit area of the sampling
grid
❖ Sampling determines the Spatial Resolution
❖ Reduction in spatial resolution results in Checker-Board
Effect.
14
Spatial Resolution contd…
Effect of varying the number of samples in a digital image
Ref. :- R. C. Gonzalez, and R. E. Woods, Digital Image Processing, Pearson
15
Spatial Resolution contd…
Effect of varying the number of samples in a digital image
Ref. :- R. C. Gonzalez, and R. E. Woods, Digital Image Processing, Pearson
16
Gray Level Resolution
❖ Gray Level Resolution
= smallest possible change in the gray level
❖ No. of quantization levels determine the gray level
resolution.
❖ Reduction in gray level resolution results in False
Contouring.
17
Gray Level Resolution contd…
Effect of varying the number of gray levels in a digital image
Ref. :- R. C. Gonzalez, and R. E. Woods, Digital Image Processing, Pearson
18
Choice of Spatial & Gray Level Resolution
❖ Details in the image play an important role in the
selection of spatial & gray level resolution
❖ For image with large details
Visual quality is more dependent on no. of pixels
than amount of gray levels
❖ For image with less details
Visual quality is more dependent on gray level
resolution than no. of pixels
19
Choice of Spatial & Gray Level Resolution contd…
Ref. :- R. C. Gonzalez, and R. E. Woods, Digital Image Processing, Pearson
20
Changing Spatial Resolution of Digital Images
❖ Shrinking Undersampling digital image
– Equivalent to row-column deletion
Ref. :- R. C. Gonzalez, and R. E. Woods, Digital Image Processing, Pearson
21
Changing Spatial Resolution of Digital Images contd…
❖ Zooming Oversampling digital image
– Need to add information which is not present Interpolation
– It is a two step process
1. Creation of new pixel location
2. Assignment of gray levels to new locations
– Types of Interpolation
1. Nearest Neighbor Interpolation (Pixel Replication)
2. Bilinear Interpolation
22
Changing Spatial Resolution of Digital Images contd…
– Nearest Neighbor Interpolation (Pixel Replication)
1 0 2 0 1 1 2 2
1 2 0 0 0 0 1 1 2 2
3 4 Zero Interlace 3 0 4 0 Replication 3 3 4 4
0 0 0 0 3 3 4 4
23
Replication:-
Q-1)Zoom the image given below by pixel replication.
1 2 3
4 5 6
Ans:-
Changing Spatial Resolution of Digital Images contd…
– Bilinear Interpolation
1 0 2 0 1 1.5 2 2
1 2 0 0 0 0 0 0 0 0
3 4 Zero Interlace 3 0 4 0 Interpolation 3 3.5 4 4
of columns
0 0 0 0 0 0 0 0
1 1.5 2 2 1 2 2 2
1.5 2.5 3 3 2 3 3 3
Interpolation 3 3.5 4 4 Rounding to 3 4 4 4
of rows valid gray level
3 3.5 4 4 3 4 4 4
24
Changing Spatial Resolution of Digital Images contd…
Ref. :- R. C. Gonzalez, and R. E. Woods, Digital Image Processing, Pearson
25
Changing Spatial Resolution of Digital Images contd…
Q. A 3-bit 4x4 image block is given below. Find the
corresponding zoomed block of size 6x6. (Use Bilinear
Interpolation) p2
1 5 4 2 p1
p (2) p (3)
p (1)
3 5 0 0
1 4 3 5
1 1 5 2
26
Basic Relationships Between Pixels
27
Basic Relationships Between Pixels
❖ Neighbors of a pixel
For a pixel p(x,y)
➢ 4-Neighbors : N4(p)
– Horizontal & Vertical neighbors
– (x+1,y), (x-1,y), (x,y+1), (x,y-1)
➢ Diagonal-Neighbors : ND(p)
– (x+1,y+1), (x-1,y+1), (x-1,y+1), (x-1,y-1)
➢ 8-Neighbors : N8(p)
– N4(p) U ND(p)
– (x+1,y), (x-1,y), (x,y+1), (x,y-1), (x+1,y+1),
(x-1,y+1), (x-1,y+1), (x-1,y-1)
Some of the neighboring pixels fall outside the image if (x,y) is on the
border of the image
28
Basic Relationships Between Pixels contd…
❖ Adjacency
V = set of gray-level values used to define adjacency
➢ 4- adjacency :
– p & q with values from V are 4-adjacent if q is in the set N4(p)
➢ 8- adjacency :
– p & q with values from V are 8-adjacent if q is in the set N8(p)
➢ m- adjacency (mixed adjacency) :
– q is in the set N4(p) or
– q is in ND(p) and set N4(p) N4(q) has no pixels whose values are
from V
Image subsets S1 & S2 are adjacent if some pixel in S1 is adjacent to some
pixel in S2.
29
Basic Relationships Between Pixels contd…
❖ Connectivity
– Two pixels p(x,y) & q(s,t) are connected if there exits a path
between them
– Path = (x0,y0), (x1,y1),…..,(xn,yn)
(x0,y0) = (x,y) &
(xn,yn) = (s,t) &
(xi,yi) is adjacent to (xi-1,yi-1) for 1≤ i ≤ n
– Length of path = n
– If x0,y0 = xn, yn then it’s a closed path
– 4-,8-, or m-paths depends on type of adjacency
– Ambiguity in 8-path can be overcome by using m-path
30
Basic Relationships Between Pixels contd…
Example of connectivity
V = {3,4} 1 4 4
2 3 1
1 1 4
1 4 4 1 4 4 1 4 4
2 3 1 2 3 1 2 3 1
1 1 4 1 1 4 1 1 4
4-connectivity 8-connectivity m-connectivity
31
Basic Relationships Between Pixels contd…
Example of connectivity
Consider the two image subsets S1 and S2. For V = {1} , determine whether
S1 and S2 are (a) 4-connected, (b) 8-connected, (c) m-connected
S1 S2
0 0 0 0 0 0 0 1 1 0
1 0 0 1 0 0 1 0 0 1
p
1 0 0 1 0 1 1 0 0 0
0 0 1 1 q1 0 0 0 0 0
0 0 1 1 1 0 0 1 1 1
S1 and S2 are not 4-connected because q is not in the set N4(p).
S1 and S2 are 8-connected because q is in the set N8(p).
S1 and S2 are m-connected because q is in the set ND(p) and N4(p) N4(q) is empty .
32
Basic Relationships Between Pixels contd…
❖ Boundary & Region
➢ Connected Components
For pixel p in S, set of pixels connected to p in S is called a connected
component of S
➢ Connected Set
If only one connected component , then set S is connected set
➢ Subset R is called Region of image if R is a connected set
➢ Boundary (border) of R is the set of pixels in R that have one or
more neighbors that are not in R.
If R is entire image then its boundary is first & last rows & columns of
pixels.
33
Basic Relationships Between Pixels contd…
❖ Boundary & Region
0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 1 1 0 0 0
0 0 0 1 1 1 1 0 0 0
0 0 0 1 1 1 0 0 0 0
0 0 0 1 1 1 0 0 0 0
0 0 0 1 1 1 1 1 0 0
0 0 0 0 0 1 1 1 0 0
0 0 0 0 0 0 1 1 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
34
Distance Measures
❖ Euclidean Distance
– For pixel p(x,y) and q(s,t)
De ( p, q) = ( x − s ) 2 + ( y − t ) 2
– The pixels having a distance less than or equal to some value r
from (x,y) are the points contained in a disk of radius r centered
at (x,y).
2
1.4 1 1.4
2 1 0 1 2
1.4 1 1.4
35
Distance Measures contd…
❖ D4 Distance (City-block Distance)
– For pixel p(x,y) and q(s,t)
D4 ( p, q) = x − s + y − t
– The pixels having a distance less than or equal to some value r
from (x,y), form a diamond centered at (x,y).
2 1 2
2 1 0 1 2
2 1 2
36
Distance Measures contd…
❖ D8 Distance
– For pixel p(x,y) and q(s,t)
D8 ( p, q) = max ( x − s , y − t )
– The pixels having a distance less than or equal to some value r
from (x, y), form a square centered at (x, y).
2 2 2 2 2
2 1 1 1 2
2 1 0 1 2
2 1 1 1 2
2 2 2 2 2
37
Distance Measures contd…
❖ Dm Distance
– It is the shortest m-path between the points.
– For finding Dm distance, the value of the distance (length of the
path) between two pixels depends on the values of the pixels
along the path as well as the values of their neighbors.
37
Distance Measures contd…
❖ Note
– The D4 and D8 between two points p and q is equal to the length
of the shortest 4-path and 8-path between these two points.
– The D4 and D8 between two points p and q are independent of
any paths that might exist between the points because these
distances involve only the coordinates of the points.
37
Questions ???
38