0% found this document useful (0 votes)
8 views54 pages

Lect 2

This document discusses the fundamentals of digital image processing, focusing on the representation and enhancement of digital images through pixels. It covers concepts such as pixel connectivity, distance metrics, and connected component analysis, along with examples of different connectivity types. The lecture also references key readings and resources for further study in the field.

Uploaded by

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

Lect 2

This document discusses the fundamentals of digital image processing, focusing on the representation and enhancement of digital images through pixels. It covers concepts such as pixel connectivity, distance metrics, and connected component analysis, along with examples of different connectivity types. The lecture also references key readings and resources for further study in the field.

Uploaded by

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

Digital Image Processing

Lecture # 2
Fundamentals & Spatial Enhancement

1
Digital Image

aagrid
gridof
ofsquares,
squares,
1 pixel
eachof
each ofwhich
which
containsaasingle
contains single
color
color

eachsquare
each squareisis
calledaapixel
called pixel(for
(for
pictureelement)
picture element)

2
Digital Image
• A set of pixels (picture elements, pels)
• Pixel means
– pixel coordinate
– pixel value
– or both
• Both coordinates and value are discrete

3
Example
640 x 480 8-bit image

DIP Lecs By Dr M.Almas Anjum College of


4
E&ME
5
6
DIGITAL IMAGE REPRESENTATION

PIXEL VALUES IN HIGHLIGHTED


REGION

A set of number
in 2D grid
CAMERA DIGITIZER
Samples the analog data and digitizes it.

7
Digital Image
Color images have 3 values per
pixel; monochrome images have
1 value per pixel.

aagrid
gridof
ofsquares,
squares,
eachof
each ofwhich
which
containsaasingle
contains single
color
color

eachsquare
each squareisis
calledaapixel
called pixel(for
(for
pictureelement)
picture element)

8
What is a Digital Image? (cont…)
•Common image formats include:
– 1 sample per point (B&W or Grayscale)
– 3 samples per point (Red, Green, and Blue)

•For most of this course we will focus on grey-scale


images
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
What
Whatare the
arethe
coordinates
coordinatesofofeach of
eachof
the
theblue pixels
bluepixels

x
x+1
x-1
y-1 y
y+1

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


4- Neighbors of a Pixel –N4(p)

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 )  N 4 ( 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
4-connectivity

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

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

28
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}

29
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

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

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

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

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


37
Distance Maps
Connected Component Analysis
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
 Copy the label from the left. 1
 Update the equivalence table.

iv.) Otherwise, assign a new label.

 Re-label with the smallest of equivalent


labels Pass 2

44
CC labeling – 4 Connectivity

45
CC labeling – 4 Connectivity

46
CC labeling – 8 Connectivity

Same
Samealgorithm
algorithmbut
butexamine
examinealso
alsothe
theupper
upperdiagonal
diagonalneighbors
neighborsofofpp

47
CC labeling – 8 Connectivity

Background pixel
Background pixel
Unlabeled Pixel
Unlabeled Pixel
Label 1

48
CC labeling – 8 Connectivity

Background pixel Background pixel


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

Label 3

49
CC labeling – 8 Connectivity

Background pixel Background pixel

Unlabeled Pixel Unlabeled Pixel


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

50
CC labeling – 8 Connectivity

Background pixel Background pixel

Unlabeled pixel Unlabeled pixel

Label 1 Label 1

Label 2 Label 2

Label 3 Label 3

51
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

52
Readings from Book (4 Edn.) th

• Chapter – 2
– 2.5
– Self Study 2.6 (page 83 – 91)
• Example Problems
– 2.2, 2.9, 2.11, 2.12, 2.13, 2.15,
2.16, 2.17,
• Chapter -2 (MATLAB version)
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

54

You might also like