Pseudo code of specific algorithm is given as follows: |
Input: Image I, number of clusters K |
Output: Superpixels boundaries B |
1 Initialize cluster centers at regular grid by sampling pixels |
2 Perturb the cluster to the lowest gradient position in a 3 3 neighborhood to get initial values of |
3 Compute initial value of membership matrix using initial values of |
4 Repeat steps 5-8 until the condition of step 9 is satisfied |
5 Update new cluster centers gray value using |
6 Update new cluster centers coordinate using |
7 Update membership matrix using new cluster centers gray value and new cluster centers coordinate |
8 Compute residual error |
9 Until threshold |
10 Post-processing to eliminate isolated points |
11 Set each cluster boundaries to B |
12 Return B |