Algorithm 1 SLIC superpixel segmentation. |
-
Input:
Processed HSIs image , Desired number of approximately superpixels K.
-
1:
Initialize cluster centers by sampling pixels at regular grid steps S.
-
2:
Move cluster centers to the lowest gradient position in a neighborhood.
-
3:
Set label for each pixel i.
-
4:
Set distance for each pixel i.
-
5:
Repeat
-
6:
for each cluster center
do
-
7:
for each pixel i in a region around
do
-
8:
Compute the distance D between and i.
-
9:
if
then
-
10:
set
-
11:
set
-
12:
end if
-
13:
end for
-
14:
end for
-
15:
Compute new cluster centers.
-
16:
Compute residual error E.
-
17:
Untilthreshold.
-
18:
Enforce connectivity.
-
Output:
Superpixel segmentations.
|