center[j] = ((float)rng*(1.f+margin*2.f)-margin)*(box[j][1] - box[j][0]) + box[j][0];
}
-class KMeansPPDistanceComputer
+class KMeansPPDistanceComputer : public ParallelLoopBody
{
public:
KMeansPPDistanceComputer( float *_tdist2,
step(_step),
stepci(_stepci) { }
- void operator()( const cv::BlockedRange& range ) const
+ void operator()( const cv::Range& range ) const
{
- const int begin = range.begin();
- const int end = range.end();
+ const int begin = range.start;
+ const int end = range.end;
for ( int i = begin; i<end; i++ )
{
break;
int ci = i;
- parallel_for(BlockedRange(0, N),
+ parallel_for_(Range(0, N),
KMeansPPDistanceComputer(tdist2, data, dist, dims, step, step*ci));
for( i = 0; i < N; i++ )
{
}
}
-class KMeansDistanceComputer
+class KMeansDistanceComputer : public ParallelLoopBody
{
public:
KMeansDistanceComputer( double *_distances,
{
}
- void operator()( const BlockedRange& range ) const
+ void operator()( const Range& range ) const
{
- const int begin = range.begin();
- const int end = range.end();
+ const int begin = range.start;
+ const int end = range.end;
const int K = centers.rows;
const int dims = centers.cols;
// assign labels
Mat dists(1, N, CV_64F);
double* dist = dists.ptr<double>(0);
- parallel_for(BlockedRange(0, N),
+ parallel_for_(Range(0, N),
KMeansDistanceComputer(dist, labels, data, centers));
compactness = 0;
for( i = 0; i < N; i++ )
int nvecs, int len, uchar* dist, const uchar* mask);
-struct BatchDistInvoker
+struct BatchDistInvoker : public ParallelLoopBody
{
BatchDistInvoker( const Mat& _src1, const Mat& _src2,
Mat& _dist, Mat& _nidx, int _K,
func = _func;
}
- void operator()(const BlockedRange& range) const
+ void operator()(const Range& range) const
{
AutoBuffer<int> buf(src2->rows);
int* bufptr = buf;
- for( int i = range.begin(); i < range.end(); i++ )
+ for( int i = range.start; i < range.end; i++ )
{
func(src1->ptr(i), src2->ptr(), src2->step, src2->rows, src2->cols,
K > 0 ? (uchar*)bufptr : dist->ptr(i), mask->data ? mask->ptr(i) : 0);
("The combination of type=%d, dtype=%d and normType=%d is not supported",
type, dtype, normType));
- parallel_for(BlockedRange(0, src1.rows),
- BatchDistInvoker(src1, src2, dist, nidx, K, mask, update, func));
+ parallel_for_(Range(0, src1.rows),
+ BatchDistInvoker(src1, src2, dist, nidx, K, mask, update, func));
}