After feature vectors have been calculated for each superpixel by feature extractor 111, the feature vectors can be provided to clustering engine 112. Clustering engine 112 may then cluster the superpixels by assigning each superpixel to a particular cluster of superpixels. Thus, for example, clustering engine 112 may generally cluster N superpixels into K clusters. The clustering may be performed based on the similarities of the feature vectors associate with each superpixel. For example, each cluster may be associated with a centroid vector, such that feature vector of each superpixel in the cluster is closest to the centroid vector of that cluster than to the centroid of any other cluster.
In some embodiments, the number of clusters K can be predefined for a particular application. For example, for a typical image segmentation problem in which the image needs to be segmented into a predefined maximum number of different regions (e.g., 5), K clusters can be set to a number that is larger but is within the order of magnitude of the predefined maximum number of regions (e.g., 15, 20, or 25). In some examples, the number of clusters K can be dynamically adjusted based on user input.