In some embodiments, clustering engine 112 may use a non-weighted Euclidean distance, where each image feature in the feature vector has the same weight. In other embodiments, however, clustering engine 112 may use a weighted Euclidean (or non-Euclidean) distance during clustering, weighing some image features higher than other. For example, in some embodiments, clustering engine 112 may determine and assign different feature weights to different image features. For example, clustering engine 112 may collect (e.g., using user interface module 115) at least one annotation (e.g., a scribble or a line) identifying a plurality of similar superpixels, i.e., superpixels that the user considers to belong to the same segment or category. Clustering engine 112 may then determine, based on the feature vectors of the similar superpixels, which image features in the feature vectors should be assigned higher feature weights than others. Some methods and systems of determining and assigning weights to different image features are described in U.S. Provisional Patent Application No. 62/136,381 and in International Patent Publication No. WO/2016150873, the entireties of which are hereby incorporated by reference.
In some embodiments, in addition to clustering the superpixels by assigning each superpixel into one of K clusters (where K is a predefined parameter), clustering engine 112 may precalculate the distances between every two clusters, i.e., the distances between centroid vectors of each cluster and each other cluster. Thus, in some embodiments, clustering engine 112 may precalculate at least K(K?1)/2 distances, which is the number of different combinations of two clusters within K clusters. Clustering engine 112 may calculate the distances between the clusters using the same measure of distance that was used for generating the clusters, for example.