EC 703:
IMAGE PROCESSING AND
COMPUTER VISION
By:
Dr. Hemant S. Goklani
IIIT, Surat
CONNECTIVITY
Connectivity between pixels is an important
concept used in establishing boundaries of objects
and components of regions in an image
To establish whether two pixels are connected, it
must be determined if they are adjacent in some
sense and if their gray levels satisfy a specified
criterion of similarity
Connectivity
Connectivity is adapted from neighborhood relation
Two pixels are connected if they are in the same class (i.e. the
same color or the same range of intensity) and they are
neighbors of one another
For p and q from the same class
w 4-connectivity: p and q are 4-connected if q N4(p)
w 8-connectivity: p and q are 8-connected if q N8(p)
w mixed-connectivity (m-connectivity):
p and q are m-connected if q N4(p) or
q ND(p) and N4(p) N4(q) =
CONNECTIVITY
0 1 1
0 1 0 Arrangement of pixels
0 0 1
0 1 1
0 1 0 4-connectivity
0 0 1
0 1 1
0 1 0 8-connectivity
0 0 1
0 1 1
0 1 0 m-connectivity
0 0 1
Adjacency
A pixel p is adjacent to pixel q if they are connected
Two image subsets S1 and S2 are adjacent if some pixel in S1 is
adjacent to some pixel in S2
S1
S2
We can define type of adjacency: 4-adjacency, 8-adjacency
or m-adjacency depending on type of connectivity
Path
A path from pixel p at (x,y) to pixel q at (s,t) is a sequence of
distinct pixels:
(x0,y0), (x1,y1), (x2,y2),…, (xn,yn)
such that
(x0,y0) = (x, y), (xn,yn) = (s,t)
and
(xi,yi) is adjacent to (xi-1,yi-1), i = 1,…,n
In this case, n is the length of the path
If (x0,y0) = (xn, yn), the path is a closed path
q
p
We can define type of path: 4-path, 8-path or m-path depending
on type of adjacency
Path (cont.)
8-path m-path
p p p
q q q
m-path from p to q
8-path from p to q
solves this ambiguity
results in some ambiguity
A. EXAMPLE
4-PATH, 8-PATH AND M-PATH CONNECTIVITY
(A) V(0, 1)
Q
3 1 2 1
2 2 0 2
1 2 1 1
1 0 1 2
P
SOLUTION
3 1 2 1
Q
2 2 0 2
1 2 1 1
P 1 0 1 2
4 – Path connectivity does not exist
3 1 2 1 Q
2 2 0 2
1 2 1 1
P 1 0 1 2
8 – Path connectivity exist. Path length = 4
SOLUTION
3 1 2 1
Q
2 2 0 2
1 2 1 1
P 1 0 1 2
m – Path connectivity exist. Path Length = 4
N4(P) ∩ N4(Q) = Ø
(2, 2) ∩ (2, 2) = Ø
Distance
For pixel p, q, and z with coordinates (x,y), (s,t) and (u,v), D is a
distance function or metric if
w D(p, q) 0 (D(p,q) = 0 if and only if p = q)
w D(p, q) = D(q,p)
w D(p, z) D(p,q) + D(q,z)
Example: Euclidean distance
De ( p, q) ( x s )2 ( y t )2
De distance measure, 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)
Distance (cont.)
D4-distance (city-block distance) is defined as
D4 ( p, q) x s y t
2 1 2
2 1 0 1 2
2 1 2
Pixels with D4(p) = 1 is 4-neighbors of p.
Distance (cont.)
D8-distance (chessboard distance) is defined as
D8 ( p, q) max( x s , y t )
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
Pixels with D8(p) = 1 is 8-neighbors of p.
DISTANCE WITH M-CONNECTIVITY
p3 p4
p1 p2
p
The value of the distance (length of the path)
between p and p4 depends on the values of the
pixels along the path and those of their neighbors
ARITHMETIC OPERATION
The principal use of image addition is for image
averaging to reduce noise
Image subtraction is a basic tool in medical
imaging, where it is used to remove static
background information
One of the principal uses of image multiplication
is to correct gray-level shading resulting from
non-uniformities in illumination or in the sensor
used to acquire the image
LOGIC OPERATION
Logic operation apply only in binary image
whereas arithmetic operation apply to
multivalued pixels
Logic operations are basic tools in binary image
processing, where they are used for task such as
masking, feature detection, and shape analysis
NOT
B NOT(B)
AND
A B A AND B
OR
A B A OR B
XOR
A B AxorB
XNOR
A AND (NOT B)
THANK YOU