0% found this document useful (0 votes)
60 views28 pages

Digital Image Processing: Lecture # 3 Connected Component Analysis

The document discusses connected component analysis in digital image processing. It defines connectivity as establishing boundaries of objects in an image by grouping pixels of the same color or intensity. Pixels are considered connected if they are adjacent and their gray levels are similar based on a specified criterion. The document describes 4-connectivity and 8-connectivity and how they determine if two pixels are neighbors. It also discusses using mixed connectivity to eliminate multiple path connections. The key steps of connected component labeling using 4-connectivity and 8-connectivity are summarized. Additionally, the document outlines distance metrics like city block distance and Euclidean distance and arithmetic operations that can be performed on images.

Uploaded by

Tahoor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views28 pages

Digital Image Processing: Lecture # 3 Connected Component Analysis

The document discusses connected component analysis in digital image processing. It defines connectivity as establishing boundaries of objects in an image by grouping pixels of the same color or intensity. Pixels are considered connected if they are adjacent and their gray levels are similar based on a specified criterion. The document describes 4-connectivity and 8-connectivity and how they determine if two pixels are neighbors. It also discusses using mixed connectivity to eliminate multiple path connections. The key steps of connected component labeling using 4-connectivity and 8-connectivity are summarized. Additionally, the document outlines distance metrics like city block distance and Euclidean distance and arithmetic operations that can be performed on images.

Uploaded by

Tahoor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 28

Digital Image Processing

Lecture # 3
Connected Component Analysis

1
Determine different regions in the
image

2
Connectivity
 Establishing boundaries of objects and components in an image
 Group the same region by assumption that the pixels being the same
color or equal intensity
 Two pixels p & q are connected if
 They are adjacent in some sense
 If their gray levels satisfy a specified criterion of
similarity

3
Connectivity
V: Set of gray levels used to define the criterion of similarity

4-connectivity
4-connectivity

If gray level ( p, q )  V , and q  N 4 ( p )

Set
Setofofgray
graylevels
levelsVV=={1}
{1}

4
Connectivity
V: Set of gray levels used to define the criterion of similarity

8-connectivity
8-connectivity

If gray level ( p, q )  V , and q  N8 ( p )

Set
Setofofgray
graylevels
levelsVV=={1}
{1}

5
Connectivity
V: Set of gray levels used to define the criterion of similarity

m-connectivity
m-connectivity(Mixed
(MixedConnectivity)
Connectivity)

If gray level

( p, q) V , and q satisfies one of the following:


a. q  N 4 ( p ) or
b. q  N D ( p) And N 4 ( p)  N 4 (q) has no pixels
whose values are from V

6
Example: m – Connectivity

 Set of gray levels V = {1}

Note: Mixed connectivity can eliminate the multiple path connections that often
occurs in 8-connectivity

7
Paths
 Path: Let coordinates of pixel p: (x, y), and of pixel q: (s, t)

 A path from p to q is a sequence of distinct pixels with


coordinates: (x0, y0), (x1, y1), ......, (xn,yn)

where (x0, y0) = (x, y) & (xn,yn) = (s, t), and (xi,yi) is adjacent
to (xi-1,yi-1) 1≤i ≤n

8
Test Yourself
CC labeling – 4 Connectivity
 Process the image from left to
right, top to bottom:
1.) If the next pixel to process is 1
i.) If only one of its neighbors
(top or left) is 1, copy its label.

ii.) If both are 1 and have the


same label, copy it.

iii.) If they have different labels


Pass 1
 Copy the label from the left.
 Update the equivalence table.

iv.) Otherwise, assign a new label.

 Re-label with the smallest of equivalent


labels
Pass 2

10
CC labeling – 4 Connectivity

11
CC labeling – 4 Connectivity

12
CC labeling – 8 Connectivity

Same
Samealgorithm
algorithmbut
butexamine
examinealso
alsothe
theupper
upperdiagonal
diagonalneighbors
neighborsofofpp

13
CC labeling – 8 Connectivity

Background pixel
Background pixel
Unlabeled Pixel
Unlabeled Pixel
Label 1

14
CC labeling – 8 Connectivity

Background pixel Background pixel


Unlabeled Pixel Unlabeled Pixel
Label 1 Label 1
Label 2 Label 2
Label 3

15
CC labeling – 8 Connectivity

Background pixel Background pixel

Unlabeled Pixel Unlabeled Pixel


Label 1 Label 1
Label 2 Label 2
Label 3 Label 3

16
CC labeling – 8 Connectivity

Background pixel Background pixel

Unlabeled pixel Unlabeled pixel

Label 1 Label 1

Label 2 Label 2

Label 3 Label 3

17
CC labeling – 8 Connectivity

Background pixel Background pixel


Unlabeled pixel Unlabeled pixel
Label 1 Label 1
Label 2 Label 2
Label 3 Label 3
Label 4 Label 4

18
Distance Metrics

 Let pixels p, q and z have coordinates (x,y),


(s,t) and (u,v) respectively.

 D is a distance function or metric if


 D(p,q) ≥ 0 and
 D(p,q) = 0 iff p = q and
 D(p,q) = D(q,p) and
 D(p,z) ≤ D(p,q) + D(q,z)

19
City block distance (D4 distance)

D4 ( p, q)  x  s  y  t

 Diamond with center at


(x,y)
 D4 = 1 are the 4 neighbors
of pixel p(x,y)

20
Chessboard distance (D8 distance)

D8 ( p, q)  max( x  s , y  t )

 Square centered at p(x,y)


 D8 = 1 are the 8 neighbors
of pixel p(x,y)

21
Euclidean Distance

De ( p, q)  ( x  s) 2  ( y  t ) 2
q(s,t)

p(x,y)

A circle with radius r centered at (x,y)


22
Arithmetic Operations

 Carried out between corresponding pixel


pairs s ( x, y )  f ( x, y )  g ( x, y )
d ( x, y )  f ( x, y )  g ( x, y )
p ( x, y )  f ( x, y )  g ( x, y )
d ( x, y )  f ( x, y )  g ( x, y )

23
Arithmetic Operations

 Conversion to range 0 – 255


 Difference of two 8-bit images: -255 to 255
 Sum of two 8-bit images: 0 to 510
 Solution?
Set all values < 0 to 0
Set all values > 255 to 255
Full range of arithmetic operation not captured
24
Arithmetic Operations

 First perform the operation


Creates an image
whose minimum
value is 0
f m  f  min( f )

 Then perform Creates a scaled


image fs with values in
the range [0 K]

f s  K  f m max( f m ) 

25
Logical Operations (Binary Images)

26
Readings from Book (3 Edn.) rd

• 2.3 Image Sensing and Acquisition


• 2.4 Image Sampling & Quantization
• 2.5 Basic Relationships between Pixels
• 2.6 (Reading Assignment)
• 8-Connectivity Algorithm (Reading
Assignment)
• Image Normalization (Reading
Assignment)
Acknowledgements
 Statistical Pattern Recognition: A Review – A.K Jain et al., PAMI (22) 2000

Material in these slides has been taken from, the following resources

Pattern Recognition and Analysis Course – A.K. Jain, MSU


 Pattern Classification” by Duda et al., John Wiley & Sons.
 Digital Image Processing”, Rafael C. Gonzalez & Richard E. Woods, Addison-Wesley, 2002
 Machine Vision: Automated Visual Inspection and Robot Vision”, David Vernon, Prentice Hall,
1991
 www.eu.aibo.com/
 Advances in Human Computer Interaction, Shane Pinder, InTech, Austria, October 2008

28

You might also like