Lines Matching refs:cluster
32 // Support class to hold information about each cluster of pixel data in
34 // that exist in the cluster, it keeps track of the aggregate sum so it can
65 // Recomputes the centroid of the cluster based on the aggregate data. The
97 // if the centroid of the cluster has moved. This determines whether or
110 // of the cluster for sorting.
123 // Holds the sum of all the points that make up this cluster. Used to
128 // The weight of the cluster, determined by how many points were used
231 // Pick a starting point for each cluster
232 std::vector<KMeanCluster>::iterator cluster = clusters.begin();
233 while (cluster != clusters.end()) {
235 // found, destroy this cluster.
255 cluster_check != cluster; ++cluster_check) {
262 // If we have a unique color set the center of the cluster to
265 cluster->SetCentroid(r, g, b);
270 // If we don't have a unique color erase this cluster.
272 cluster = clusters.erase(cluster);
275 // for loop will skip a cluster due to the erase if the color wasn't
277 ++cluster;
290 // Loop through each pixel so we can place it in the appropriate cluster.
305 // Figure out which cluster this color is closest to in RGB space.
306 for (std::vector<KMeanCluster>::iterator cluster = clusters.begin();
307 cluster != clusters.end(); ++cluster) {
308 uint32_t distance_sqr = cluster->GetDistanceSqr(r, g, b);
312 closest_cluster = cluster;
319 // Calculate the new cluster centers and see if we've converged or not.
321 for (std::vector<KMeanCluster>::iterator cluster = clusters.begin();
322 cluster != clusters.end(); ++cluster) {
323 convergence &= cluster->CompareCentroidWithAggregate();
325 cluster->RecomputeCentroid();
334 // Loop through the clusters to figure out which cluster has an appropriate
336 for (std::vector<KMeanCluster>::iterator cluster = clusters.begin();
337 cluster != clusters.end(); ++cluster) {
339 cluster->GetCentroid(&r, &g, &b);
349 } else if (cluster == clusters.begin()) {
357 // Find a color that actually appears in the image (the K-mean cluster center