Lec 4
Lec 4
Objectives
Neighborhood
Adjacency
Connectivity
Paths
(x,y-1) 4-neighbors of p:
(x-1,y) p (x+1,y)
(x−1,y)
(x+1,y)
N4(p) = (x,y−1)
(x,y+1)
(x,y+1)
p
(x−1,y−1)
(x+1,y−1)
ND(p) = (x−1,y+1)
(x-1,y+1) (x+1,y+1)
(x+1,y+1)
(x-1,y) p (x+1,y)
(x−1,y−1)
(x,y−1)
(x+1,y−1)
(x-1,y+1) (x,y+1) (x+1,y+1)
(x−1,y)
N8(p) = (x+1,y)
(x−1,y+1)
(x,y+1)
(x+1,y+1)
8-neighborhood relation considers all neighbor pixels.
Basic Relationships Between Pixels
S1
S2
We can define type of adjacency: 4-adjacency, 8-adjacency
or m-adjacency depending on type of connectivity.
Path
q
p
8-path m-path
p p p
q q q
0 1 1 0 1 1 0 1 1
0 2 0 0 2 0 0 2 0
0 0 1 0 0 1 0 0 1
Examples: Adjacency and Path
V = {1, 2}
0 1 1 0 1 1 0 1 1
0 2 0 0 2 0 0 2 0
0 0 1 0 0 1 0 0 1
8-adjacent
Examples: Adjacency and Path
V = {1, 2}
0 1 1 0 1 1 0 1 1
0 2 0 0 2 0 0 2 0
0 0 1 0 0 1 0 0 1
8-adjacent m-adjacent
Examples: Adjacency and Path
V = {1, 2}
01,1 11,2 11,3 0 1 1
0 1 1
02,1 22,2 02,3 0 2 0
0 2 0
03,1 03,2 13,3 0 0 1
0 0 1
8-adjacent m-adjacent
The 8-path from (1,3) to (3,3): The m-path from (1,3) to (3,3):
(i) (1,3), (1,2), (2,2), (3,3) (1,3), (1,2), (2,2), (3,3)
(ii) (1,3), (2,2), (3,3)
Examples: Adjacency and Path
V = {1, 2}
01,1 11,2 11,3 0 1 1
0 1 1
02,1 22,2 02,3 0 2 0
0 2 0
03,1 03,2 13,3 0 0 1
0 0 1
8-adjacent m-adjacent
The 8-path from (1,3) to (3,3): The m-path from (1,3) to (3,3):
(i) (1,3), (1,2), (2,2), (3,3) (1,3), (1,2), (2,2), (3,3)
(ii) (1,3), (2,2), (3,3)
Distance
D(p,q) = D(q,p)
De ( p, q) = ( x − s ) 2 + ( y − t ) 2
Distance Measures
The Euclidean Distance between p and q is defined as:
De (p,q) = [(x – s)2 + (y - t)2]1/2
q
(s,t)
p
(x,y)
Distance Measures
D4
p
(x,y)
Distance (cont.)
D4 ( p, q) = x − s + y − t
2
2 1 2
2 1 0 1 2
2 1 2
2
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
D8(b)
p D8(a)
(x,y)
D8 = max(D8(a) ,
D8(b))
Region and Boundary
Region
Let R be a subset of pixels in
an image, we call R a region of the
image if R is a connected set.
Boundary
The boundary (also called border
or contour) of a region R is the set of pixels in
the region that have one or more neighbors
that are not in R.
Region and Boundary
If R happens to be an entire image, then its boundary is defined
as the set of pixels in the first and last rows and columns in the image.
26
Set and Logical Operations
Set and Logical Operations
A = {( x, y, z ) | z = f ( x, y )}
The complement of A is denoted Ac
Ac = {( x, y, K − z ) | ( x, y, z ) A}
K = 2k − 1; k is the number of intensity bits used to represent z
28
Set and Logical Operations
A B = {max(a, b) | a A, b B}
z
29
Set and Logical Operations
30
Set and Logical Operations
31
Color Image Processing
C 1 R
M = 1 − G
Y 1 B
Intensity
Saturation
Chapter 6
Color Image Processing
Color Image Processing
Color Components
Color Image Processing