0% found this document useful (0 votes)
2 views

lecture02

The document discusses key concepts in digital image processing, focusing on spatial and intensity level resolution, image resizing, and interpolation methods. It explains the importance of resolution in image quality and details various connectivity types for image component analysis. Additionally, it covers arithmetic operations on images and provides references for further reading.

Uploaded by

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

lecture02

The document discusses key concepts in digital image processing, focusing on spatial and intensity level resolution, image resizing, and interpolation methods. It explains the importance of resolution in image quality and details various connectivity types for image component analysis. Additionally, it covers arithmetic operations on images and provides references for further reading.

Uploaded by

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

Digital Image Processing

Lecture # 2
Connected Component Analysis

1
Spatial & Gray Level Resolution
Spatial Resolution

3
Spatial Resolution

4
Intensity Level Resolution
 Intensity level resolution refers to the number of intensity levels used to represent the
image

 The more intensity levels used, the finer the level of detail in
an image
 Intensity level resolution is usually given in terms of the
number of bits used to store each intensity level

5
Intensity Level Resolution

Number of Intensity
Number of Bits Examples
Levels
1 2 0, 1
2 4 00, 01, 10, 11
4 16 0000, 0101, 1111
8 256 00110011, 01010101
16 65,536 1010101010101010

6
Intensity Level Resolution

7
Intensity Level Resolution
256 grey levels (8 bits per pixel) 128 grey levels (7 bpp) 64 grey levels (6 bpp) 32 grey levels (5 bpp)

16 grey levels (4 bpp) 8 grey levels (3 bpp) 4 grey levels (2 bpp) 2 grey levels (1 bpp)
8
Resolution: How much is enough?

 How many samples and gray levels are required


for a good approximation?
 Quality of an image depends on number of pixels and gray-
level number
 The more these parameters are increased, the closer the
digitized array approximates the original image
 But: Storage & processing requirements increase rapidly as a
function of N, M, and k

9
Resolution: How much is enough?

 Depends on what is in the image and what you


would like to do with it

10
Image Resizing
 Pixel replication
[1 2 3 4 5]
[1 1 2 2 3 3 4 4 5 5] (One step)
[1 1 1 2 2 2 3 3 3 4 4 4 5 5 5] (Two step)

11
Enlarging an Image

Example:
zoom this
image 4x to
get this
image.

.
.
Start with a blank image 4 times the Fill
. in every 4th pixel in every 4th
linear dimensions of the original. row with the original pixel values.

13
Enlarging an Image







Detail showing every 4th pixel in every 4th row with the original pixel values.

14
Enlarging an Image

Replicate the values

15
Image Interpolation

 Nearest neighbour interpolation


 Simple but produces undesired artefacts
 Bilinear Interpolation
 Contribution from 4 neighbors
 Bicubic Interpolation
 Contribution from 16 neighbors

16
Interpolation: Comparison

We’ll enlarge this image


by a factor of 4 …

… via bilinear interpolation


and compare it to a nearest
neighbor enlargement.
Interpolation: Comparison

Original
Image

To better see what happens, we’ll look at the parrot’s eye.


Interpolation: Comparison

Pixel replication Bilinear interpolation


Interpolation: Comparison

Pixel replication Bilinear interpolation


Relationships between pixels

 Neighbors of pixel are the pixels that are


adjacent pixels of an identified pixel

y-1 y y+1
x-1

x
x+1

22
4- Neighbors of a Pixel –N4(p)

coordinates of each of y-1 y y+1


x-1
the blue pixels
What are the

x
x+1

(x-1,y), (x+1,y), (x, y-1), (x, y+1)

23
Diagonal Neighbors of a Pixel –ND(p)

y-1 y y+1
x-1

x
x+1

(x-1,y-1), (x+1,y-1), (x-1, y+1), (x+1, y+1)

24
8- Neighbors of a Pixel –N8(p)

y-1 y y+1
x-1

x
x-1

N8 ( p)  N4 ( p)  N D ( 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)
25
Determine different regions in the
image

26
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

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

4-connectivity

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

Set of gray levels V = {1}

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

8-connectivity

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

Set of gray levels V = {1}

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

m-connectivity (Mixed Connectivity)

If gray level

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


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

30
Example: m – Connectivity

 Set of gray levels V = {1}

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

31
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

32
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

35
CC labeling – 4 Connectivity

36
CC labeling – 4 Connectivity

37
CC labeling – 8 Connectivity

Same algorithm but examine also the upper diagonal neighbors of p

38
CC labeling – 8 Connectivity

Background pixel
Background pixel
Unlabeled Pixel
Unlabeled Pixel
Label 1

39
CC labeling – 8 Connectivity

Background pixel Background pixel


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

Label 3

40
CC labeling – 8 Connectivity

Background pixel Background pixel

Unlabeled Pixel Unlabeled Pixel


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

41
CC labeling – 8 Connectivity

Background pixel Background pixel

Unlabeled pixel Unlabeled pixel

Label 1 Label 1

Label 2 Label 2

Label 3 Label 3

42
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

43
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)

44
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)

45
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)

47
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)


49
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 )

50
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
51
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 )

52
Assignment-1
Readings from Book (4th Edn.)
• Chapter – 2
Acknowledgements
 Statistical Pattern Recognition: A Review – A.K Jain et al., PAMI (22) 2000
 Pattern Recognition and Analysis Course – A.K. Jain, MSU
Material in these slides has been taken from, the following resources

 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

56

You might also like