30. Some Basic Relationships Between
Pixels
Neighbors of a pixel
: 4-neighbors of p
, , ,
: four diagonal neighbors of p
, , ,
: 8-neighbors of p
and
)
(
4 p
N
)
,
1
( y
x )
1
,
(
y
x
)
,
1
( y
x )
1
,
(
y
x
)
1
,
1
(
y
x )
1
,
1
(
y
x
)
1
,
1
(
y
x
)
1
,
1
(
y
x
)
(p
ND
)
(
8 p
N
)
(
4 p
N )
(p
ND
31. Adjacency
: The set of gray-level values used
to define adjacency
4-adjacency: Two pixels p and q with
values from V are 4-adjacency if q is in
the set
8-adjacency: Two pixels p and q with
values from V are 8-adjacency if q is in
the set
V
)
(
4 p
N
)
(
8 p
N
32. m-adjacency (mixed adjacency): Two
pixels p and q with values from V are
m-adjacency if
q is in , or
q is in and the set
has no pixels whose values are from V
)
(
4 p
N
)
(p
ND
)
(
)
( 4
4 q
N
p
N
33. Subset adjacency
S1 and S2 are adjacent if some pixel in
S1 is adjacent to some pixel in S2
Path
A path from p with coordinates to
pixel q with coordinates is a
sequence of distinct pixels with
coordinates
, ,…,
where = , = ,
and pixels and are
adjacent
)
,
( y
x
)
,
( t
s
)
,
( 0
0 y
x )
,
( 1
1 y
x )
,
( n
n y
x
)
,
( 0
0 y
x )
,
( y
x )
,
( n
n y
x )
,
( t
s
)
,
( i
i y
x )
,
( 1
1
i
i y
x
34. Region
We call R a region of the image if R is a
connected set
Boundary
The boundary of a region R is the set of
pixels in the region that have one or
more neighbors that are not in R
Edge
Pixels with derivative values that
exceed a preset threshold
35. Distance measures
Euclidean distance
City-block distance
Chessboard distance
2
1
2
2
]
)
(
)
[(
)
,
( t
y
s
x
q
p
De
|
)
(
|
|
)
(
|
)
,
(
4 t
y
s
x
q
p
D
|)
)
(
|
|,
)
(
max(|
)
,
(
8 t
y
s
x
q
p
D
36. m
D
distance: The shortest m-path
between the points
Linear operation
H is said to be a linear operator if, for
any two images f and g and any two
scalars a and b,
)
(
)
(
)
( g
bH
f
aH
bg
af
H
37. Example
Zooming and Shrinking Images by Pixel
Replication
(a) Write a computer program capable of zooming
and shrinking an image by pixel replication.
Assume that the desired zoom/shrink factors are
integers. You may ignore aliasing effects. You will
need to download Fig. 2.19(a).
(b) Download Fig. 2.19 (a) and use your program
to shrink the image from 1024 x 1024 to 256 x
256 pixels.
(c) Use your program to zoom the image in (b)
back to 1024 x 1024. Explain the reasons for their
differences.