In some embodiments, clustering engine 112 may cluster the superpixels using a k-means clustering algorithm such as the Lloyd's algorithm, or using any related clustering algorithms such as the k-medians clustering algorithm; the k-medoids or the partitioning around medoids (PAM) algorithm; the Fuzzy C-Means Clustering algorithm; the Gaussian mixture models trained with expectation-maximization algorithm; the k-means++ algorithm; hierarchical variants such as Bisecting k-means, X-means clustering, or G-means clustering; and the like. In other embodiments, clustering engine 112 may use any other algorithm suitable for clustering the superpixels into a predefined number of clusters based on the similarities of superpixels' feature vectors.
K-means or other algorithms mentioned above typically perform clustering based on distances between the feature vectors and the centroid vector of each cluster. In some embodiments, clustering engine 112 may use a Euclidean distance as the distance metric for performing the clustering. In other embodiments, clustering engine 112 may use other distance metrics such as the sum of absolute differences, correlation and hamming distance, and so forth.