Lect 2
Lect 2
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
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)
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
23
Diagonal Neighbors of a Pixel –ND(p)
y-1 y y+1
x-1
x
x+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)
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
Set
Setofofgray
graylevels
levelsVV=={1}
{1}
28
Connectivity
V: Set of gray levels used to define the criterion of similarity
8-connectivity
8-connectivity
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
30
Example: m – Connectivity
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)
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
34
City block distance (D4 distance)
D4 ( p, q) x s y t
35
Chessboard distance (D8 distance)
D8 ( p, q) max( x s , y t )
36
Euclidean Distance
De ( p, q ) ( x s ) 2 ( y t ) 2
q(s,t)
p(x,y)
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
Label 3
49
CC labeling – 8 Connectivity
50
CC labeling – 8 Connectivity
Label 1 Label 1
Label 2 Label 2
Label 3 Label 3
51
CC labeling – 8 Connectivity
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
54