2. 1
Objective: Divide an image into separate regions that
are homogeneous wrt some properties, e.g., brightness,
color, reflectivity, texture, proximity.
(
i
) , ;
(
i
i
) , ;
(
i
i
i
)
i
i j
i
R i
R R i j
R R
Categories of segmentation techniques:
Thresholding, Edge-based, Region-based
Mathematically, image segmentation = set partition
Color
Proximity
6
3. 2
6.1 Thresholding
1
i
f (
,)
(
,)
0 o
t
h
e
r
w
i
s
e
fij T
g
ij
(A) Global Thresholding – threshold T is determined
from the whole image f, i.e., T = T(f)
Input image High threshold Low threshold
How to determine a threshold?
6
4. 3
3
1
i
f (
,)
(
,)
0 o
t
h
e
r
w
i
s
e
fij D
g
ij
D: a set of gray values
(B) Band Thresholding
(C) Multiple Thresholding
1
2
1 if ( , )
2 if ( , )
( , )
if ( , )
0 otherw
ise
n
f i j D
f i j D
g i j
n f i j D
(D) Semi-thresholding
(
,)i
f(
,)
(
,)
0 o
t
h
e
r
w
i
s
e
f
i
j f
i
j T
g
i
j
6
5. 4
4
(E) Adaptive Thresholding
-- Threshold values vary over the image as a
function of local image characteristics
(i) Divide image into strips (ii) Apply global threshold
method to each strip
6
6. 5
。 P-tile Thresholding – The percentage of foreground
and background after segmentation is known a priori
e.g., In a printed text sheet,
we know that characters
of text cover 1/p of the
sheet area
。 Mode Method – Find local maxima; then detect
minima between them as thresholds
6.1.1 Threshold Detection Methods
6
7. 6
6
。 Histogram Transformation – build a histogram with
a better peak-to-valley ratio
e.g., (a) Weight histogram in favor of pixels with
high image gradients
(b) Uses only high-gradient pixels to build the
histogram (unimodal)
。 Histogram concavity analysis method
。 Entropic method
。 Relaxation method
。 Multi-threshold
6
8. 7
7
• Otsu’s threshold method
Describe the histogram as a probability
distribution by i i
p n
/
N
6.1.2 Optimal Thresholding
6
9. 8
8
Let t be the determined threshold value
Define
Find t such that
2
( (
) (
)
)
m
a
x
{ }
,
(
)
(
)
a
t
N
m
t m
a
t
a
t
b
t
1
0 1
(
) , (
) ,
t L
i i
i it
a
t pb
t p
1
0
(
) (
) 1
L
i
i
a
t b
t p
0
(
) , :
i
m
a
g
e
s
i
z
e
t
a i
i
m
t ip
N
1
0
w
h
e
r
e ,
L
i
i
m i p
6
10. 9
9
Histogram h
of an image
Fitting Gaussian
distributions
Fitted Gaussian
distributions
• MOG fitting method – approximate the histogram
of an image with a mixture of Gaussian
6
11. 10
2 2
( )/
2
(
) , 1
,
2
k k
i
k
k
e
G
i k
1
12
2
(
) ,
f
i P
G
P
G
• Mixture of Gaussians
let v be the gray level corresponding to the
deepest valley of a histogram h
1
2
1
2
1
2
T
o
d
e
t
e
r
m
i
n
e
,
,
,
,
,
,
P
P
6
12. 11
1
2
2 2
2
1
(
)
( )
L
iv
h
i i
N
2 2
2 2
2 2
2 1
( ) /2
L
i
i v
N
P
e
1
1 2
0
(
)
, (
)
v L
i iv
N h
i N h
i
1
1 2
0
1 2
1 1
(
)
, (
)
v L
i i
v
h
ii h
ii
N N
2
1 1
0
1
1
(
)
( )
,
v
i
h
i i
N
2 2
1 1
1 1
1
( ) /2
0
,
v
i
i
N
P
e
Compute
Compute the optimal threshold T by
2 21 12 2
1
22 22 22
1
2
12 2
1 12
1
1
( )2
( ) 2
l
n0
P
T T
P
6
15. 14
Let
Step 1: Smoothing and Edge detection
(a) Horizontal direction
(b) Vertical direction
(c) Edge magnitude
v v
E
I G
2
2
2
3
()
2
x
x
G
x e
,
h h
E
I G
2
2
2
1
() ,
2
x
G
x e
:
I
n
p
u
t
i
m
a
g
e
,
I
2 2
h v
E E E
• Canny edge detector (See sec. 5.3.3)
6
16. 15
Step 2: Non-maximum suppression
(a) For each pixel p,
(b) Quantize to
0, 45, 90 or 135 degs.
(c) Along
p is marked if its edge magnitude
is larger than both its two neighbors
p is deleted otherwise
1
t
a
n ( )
v
p
h
E
E
p
p
p
p
E
6
18. 17
Step 3: Hysteresis thresholding
For each marked pixel p,
(a) If > or
(b) If and p is adjacent to
an edge pixel
p is considered as an edge pixel
H
t
p
E
L p H
t Et
6
21. 20
9-20
○ Line equation: y = ax + b
A point on the line
Rewrite as
Another point on the line
Parameter space Accumulator array
0 0
( , )
x y 0 0
y a
x b
0 0
bx
ay
1 1
( , )
x y 1 1
bx
ay
6
22. 21
9-21
○ Line equation: c
o
s s
i
n
s
x y
0 0 1 1
0 1 01 10
0 1 0 1
,
,
y a
x b y a
x b
y y xy x
y
a b
x x x x
○ Randomized HT
6
26. 25
25
○ Generalized Hough Transform:
1. Select a reference point inside the sample
region
2. Construct a line starting at aiming region
border
3. Find the edge direction at the intersection
4. Construct a reference table (caller R-table)
Assume the shape, size and orientation of the
desired region are known
R
x
R
x
6
27. 26
9-26
5. For each , compute potential
reference points by
()(, )
i i
j i j j
r
x
( c
o
s
, s
i
n
)
i i i i
j j j j
x
r y
r
(, )
R
x
y
x
R-Table
6
29. 28
28
6.3 Region-based Segmentation
○ Splitting and Merging
1. Equally divide the input image into 4
sub-images;
2. Compute the characteristics of each
sub-image, e.g., intensity, color, texture etc;
3. Repeatedly divide sub-images into
sub-sub-images if their characteristics are
significantly different;
4. Repeatedly merge adjacent sub-images if
their characteristics are similar enough.
Steps:
6
35. 34
34
Idea: Catchment basin of the topographic surface are
homogeneous in the sense that all pixels belonging
to the same catchment basin are connected with the
basin’s region of minimum altitude by a simple path
of pixels that have monotonically decreasing altitude
along the path. Such catchment basins represent the
regions of the segmented image
Approach 1:
Steps: 1. Finding a downstream path from each pixel
to a local minimum of image surface altitude;
2. A catchment basin is defined as the set of
pixels for which their downstream paths all
end up in the same altitude minimum.
6
36. 35
35
Approach 2 (Vincent and Soille, IEEE PAMI, 13(6), 1991):
Idea: The water fills all catchment basins. If two
basins are to merge, a dam is built all the
way to the highest surface altitude and the
dam represents the watershed line.
6
37. 36
36
1. Sorting step:
i, Compute a histogram of the intensity image
ii, Create a list of pointers to pixels of each
intensity h
Algorithm 6.21
i, Every pixel having grey level <= k has been
assigned a catchment basin label.
ii, A pixel having grey level k+1 belongs to a label
l if at least one of its neighbors carries this label.
iii, Construct a geodesic influence zones for all
determined catchment basins.
2. Flooding step:
6
38. 37
37
For basin , this is the locus of non-labeled pixels
of grey-level k+1 that are contiguous (via pixels of
intensity k+1) with the basin for which their
distances to is smaller than their distances to any
other
i
l
i
l
i
l
j
l
6
39. 38
38
iv, (a) Pixels that belong to the influence zone of
catchment l are also labeled as l.
(b) Pixels that are on the boundary of influence
zones are marked as watershed.
(c) Pixels that can not be assigned an existing
label or watershed represent newly discovered
catchment basis are marked with new and
unique labels.
6