|
|
@ -128,7 +128,7 @@ static void generateCentersPP(const Mat& data, Mat& _out_centers, |
|
|
|
|
|
|
|
|
|
|
|
parallel_for_(Range(0, N), |
|
|
|
parallel_for_(Range(0, N), |
|
|
|
KMeansPPDistanceComputer(tdist2, data, dist, ci), |
|
|
|
KMeansPPDistanceComputer(tdist2, data, dist, ci), |
|
|
|
divUp(dims * N, CV_KMEANS_PARALLEL_GRANULARITY)); |
|
|
|
(double)divUp((size_t)(dims * N), CV_KMEANS_PARALLEL_GRANULARITY)); |
|
|
|
double s = 0; |
|
|
|
double s = 0; |
|
|
|
for (int i = 0; i < N; i++) |
|
|
|
for (int i = 0; i < N; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -429,14 +429,14 @@ double cv::kmeans( InputArray _data, int K, |
|
|
|
if (isLastIter) |
|
|
|
if (isLastIter) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// don't re-assign labels to avoid creation of empty clusters
|
|
|
|
// don't re-assign labels to avoid creation of empty clusters
|
|
|
|
parallel_for_(Range(0, N), KMeansDistanceComputer<true>(dists, labels, data, centers), divUp(dims * N, CV_KMEANS_PARALLEL_GRANULARITY)); |
|
|
|
parallel_for_(Range(0, N), KMeansDistanceComputer<true>(dists, labels, data, centers), (double)divUp((size_t)(dims * N), CV_KMEANS_PARALLEL_GRANULARITY)); |
|
|
|
compactness = sum(Mat(Size(N, 1), CV_64F, &dists[0]))[0]; |
|
|
|
compactness = sum(Mat(Size(N, 1), CV_64F, &dists[0]))[0]; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
// assign labels
|
|
|
|
// assign labels
|
|
|
|
parallel_for_(Range(0, N), KMeansDistanceComputer<false>(dists, labels, data, centers), divUp(dims * N * K, CV_KMEANS_PARALLEL_GRANULARITY)); |
|
|
|
parallel_for_(Range(0, N), KMeansDistanceComputer<false>(dists, labels, data, centers), (double)divUp((size_t)(dims * N * K), CV_KMEANS_PARALLEL_GRANULARITY)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|