Image Processing Reference
In-Depth Information
Initialize
K
= cluster size, ε = distortion threshold,
C
0
=
{
C
k
, k
=1, 2,
…
, K
} = initial cluster centroids,
Set
m
= 0 and
D
0
>> 1 (a large positive number =
1000),
A
1
=
A
2
=
…
=
A
K
= empty set
i
=15
E
=0
Update
K
partition sets
A
1
,
A
2
, …,
A
K
Enter
N
= number of
training samples from the
database
[
u
1
,
u
2
, …,
u
N
]
[
y
1
,
y
2
, …,
y
N
]
1. Compute
J
= arg min
D
= arg min
d
(
y
i
,
C
k
)
k
k
where
d
is the Euclidian distance
2. Accumulate
y
i
into
A
J
3. Compute distortion
E
=
E
+
D
min
where
D
min
= minimum of
d
obtained in part (1)
i = i +
1
Is
i
=
N
?
No
Yes
1. Find the centroid of each cluster
Σ
L
k
L
k
A
k
(
i
)
i =
1
,
L
k
= number of vectors in
A
k
C
k
=
E
2. Compute average distortion
D
m
=
m
=
m
+1
E=
0
N
Store new
centroids {
C
k
,
k
= 1, 2, …,
K
}
Also calculate the centroids for CMYK
space using the color indices for each
cluster and store them
Is
Yes
No
D
m
-1
-
D
m
<
ε?
D
m
FIGURE 7.6
Flowchart of the centroid and cluster assignment in L*a*b* space.
Note: The training database vectors y
1
, y
2
,...,y
N
are used for centroid and cluster assignments
in L*a*b* space. If the same is required in CMYK space, then use training database vectors
u
1
, u
2
,..., u
N
.
Search WWH ::
Custom Search