diff --git a/modules/core/src/kmeans.cpp b/modules/core/src/kmeans.cpp index cbf9e47b87..9613971d6b 100644 --- a/modules/core/src/kmeans.cpp +++ b/modules/core/src/kmeans.cpp @@ -128,7 +128,7 @@ static void generateCentersPP(const Mat& data, Mat& _out_centers, parallel_for_(Range(0, N), 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; for (int i = 0; i < N; i++) { @@ -429,14 +429,14 @@ double cv::kmeans( InputArray _data, int K, if (isLastIter) { // don't re-assign labels to avoid creation of empty clusters - parallel_for_(Range(0, N), KMeansDistanceComputer(dists, labels, data, centers), divUp(dims * N, CV_KMEANS_PARALLEL_GRANULARITY)); + parallel_for_(Range(0, N), KMeansDistanceComputer(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]; break; } else { // assign labels - parallel_for_(Range(0, N), KMeansDistanceComputer(dists, labels, data, centers), divUp(dims * N * K, CV_KMEANS_PARALLEL_GRANULARITY)); + parallel_for_(Range(0, N), KMeansDistanceComputer(dists, labels, data, centers), (double)divUp((size_t)(dims * N * K), CV_KMEANS_PARALLEL_GRANULARITY)); } }