Digital Image
Processing
2nd Edition
S.
Sridhar
Chapter – 3
Digital Image Processing Operations
BASIC RELATIONSHIPS AND DISTANCE METRICS
Image Coordinate
System
Image Coordinate system
Image Topology
A pixel p at (x,y) has 4-horizontal/vertical neighbours at (x+1,y),
(x-1,y), (x,y+1) and (x,y-1). These are called the 4-neighbours of p :
N4(p).
Diagonal Elements
A pixel p at (x,y) has 4 diagonal neighbours at (x+1,y+1), (x+1,y-1),
(x-1,y+1) and (x-1,y-1). These are called the diagonal-neighbours of
p : ND(p)
8-Neighbourhood
The 4-neighbours and the diagonal neighbours of p are
called 8-neighbours of p : N8(p).
Adjacency
• If two pixels are neighbors and their gray level values satisfy some
specified criterion, then they are connected. A set of intensity values (V)
is used to define adjacency and connectivity. There are three types of
adjacency
4‐adjacency
• p and q pixels are 4‐adjacency if they are N4(p) with values from V.
8‐adjacency
• p and q pixels are 8‐adjacency if they are N8(p) with values from V.
m‐adjacency (mixed)
• p and q pixels are m‐adjacency if;
1 1 0
• q is in N4(p) or, 0 1 1
• q is in ND(p) and N4(p) ⋂ N4(q) = ⦰ with values from V.
1 0 1
• Find 4-adjacency, 8-adjacency and m adjacency for the above image for
V= {1}
Connectivity
Two pixels are said to be connected:
• if they are adjacent in some sense
(neighbour pixels, 4/8/m-adjacency)
• if their gray levels satisfy a specified
criterion of similarity(equal intensity level)
Connectivity
8-connectivity Vs m-connectivity
• Consider the following image with marked pixels p and q. If V = {1,2},
find the shortest m-path between pixels p and q
3 3 2 1 (q)
2 2 0 2
0 2 1 1
1 (p) 0 1 2
V = {1,2}
3 3 2 1 (q)
2 2 0 2
0 2 1 1
1 (p) 0 1 2
Shortest distance =4
Relations
Distance Measures
Distance Measures
• Let V= {0,1}. Compute De, D4, D8 and Dm distances between 2 pixels p
and q. Let the pixel coordinates of p and q be (3,0) and (2,3)
respectively
0 1 2 3
0 0 1 1 1
1 1 0 0 1
2 1 1 0 1 (q)
3 1 (p) 1 1 1
•
0 1 1 1 0 1 1 1
1 0 0 1 1 0 0 1
1 1 0 1 1 1 0 1
1 1 1 1 1 1 1 1
D4 D8
0 1 1 1
1 0 0 1
1 1 0 1
X
1 1 1 1
Dm
Important Image Characteristics
• Let S be subset of pixels in an image
• Two pixels p and q are said to be connected in S if there exist
a path between them consisting entirely of pixels in S.
• For any pixel p in S the set of pixels that are connected to it
in S is called connected component of S.
• If S has only one connected component, then it is called
connected set/Region.
• 2 regions R1 and R2 are called adjacent if the union of
the sets also forms a connected component
• If the regions are not adjacent, it is called disjoint set.
• The boundary of a region R is the set of pixels in the
region, that have one or more neighbours not in R
Classification of Image Operations
• One way of classification is Point
• Local and Global
Classification
Image Vs Array Operations
Arithmetic operations - Addition
Image Subtraction
Image Multiplication
Image Division
Image Division
Image Blending
• For 2 images f1, f2, Image or Alpha blending blends 2 images of the
same size. The operation is useful for transparency and composting.
The resultant image is a combination of 2 input images. This can be
mathematically stated as:
g(x,y) = α f1(x,y) +(1- α)f2(x,y)
• Consider the following images f1 and f2. Perform addition,
subtraction, multiplication and division operations.
1 3 7
5 15 75
200 50 150
50 150 125
45 55 155
200 50 75
Logical Operations
XOR
NOT Operation
Geometrical Operation
Scaling Operations
Reflection
Reflection along X
Shearing
Rotation
Affine Transform
Inverse Transform
Image Interpolation
• Downsampling
Image Interpolation techniques
NEED FOR INTERPOLATION TECHNIQUES
• Forward Sampling:
An input pixel's value is copied to its corresponding output pixel
location after a transformation. This method is used to create a new
image from an existing one by spatially transforming the pixels
• Backward mapping:
This technique starts with a pixel location in the output (corrected or
interpolated) image and works backward to determine the corresponding
pixel location and value in the original (input) image.
Image Interpolation techniques
• In both the techniques, all the pixels may not be fitted into the new
coordinates.
• Example: consider the rotation of a point (10,5) by 45⁰.
x’ = x cos θ – y sin θ =
y’ = x sin θ +y cos θ =
• The new coordinate positions are not integers and the process may
leave a gap in the new coordinate position and creates a poor quality
output.
• Therefore interpolation techniques fit the output to the new
coordinate poistion
Some popular inaterpolation techniques are:
• Nearest neighbour technique/ zero order interpolation technique
• Bilinear Technique
• Bicubic Technique
• Nearest neighbor interpolation is a simple method to estimate the value
of a data point at an unknown location by using the value of the nearest
known data point.
• It's a fast and computationally inexpensive approach, particularly
useful when speed is prioritized over accuracy.
• Can lead to a blocky or pixelated appearance, especially in images
• Doesn't create smooth transitions between data points.
• Bilinear interpolation is an image interpolation technique
that estimates pixel values in a new image by using a weighted
average of the four nearest pixel values in the original image. It's a
common method for resizing or transforming images, providing a
balance between computational efficiency and visual quality
• Bicubic interpolation is an image resampling technique
that estimates pixel values by considering a 4x4 neighborhood of
surrounding pixels, resulting in a smoother and more detailed
image compared to simpler methods like nearest neighbor or
bilinear interpolation.
• In contrast to bilinear interpolation, which only takes 4 pixels
(2×2) into account, bicubic interpolation considers 16 pixels (4×4)
Visual comparison of different interpolation methods. (a)
Nearest-neighbor. (b) Bilinear. ( c )Bicubic. (d) Original HR
image (4x)
Upsampling
Set Operations
Summary