mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
@@ -362,7 +362,7 @@ public:
|
||||
}
|
||||
|
||||
cv::AutoBuffer<double> _buf(buf_sz+noutputs);
|
||||
double* buf = _buf;
|
||||
double* buf = _buf.data();
|
||||
|
||||
if( !_outputs.needed() )
|
||||
{
|
||||
@@ -924,7 +924,7 @@ public:
|
||||
_idx[i] = i;
|
||||
|
||||
AutoBuffer<double> _buf(max_lsize*2);
|
||||
double* buf[] = { _buf, (double*)_buf + max_lsize };
|
||||
double* buf[] = { _buf.data(), _buf.data() + max_lsize };
|
||||
|
||||
const double* sw = _sw.empty() ? 0 : _sw.ptr<double>();
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ public:
|
||||
int nvars = (int)varIdx.size();
|
||||
double sumw = 0., C = 1.;
|
||||
cv::AutoBuffer<double> buf(n + nvars);
|
||||
double* result = buf;
|
||||
double* result = buf.data();
|
||||
float* sbuf = (float*)(result + n);
|
||||
Mat sample(1, nvars, CV_32F, sbuf);
|
||||
int predictFlags = bparams.boostType == Boost::DISCRETE ? (PREDICT_MAX_VOTE | RAW_OUTPUT) : PREDICT_SUM;
|
||||
|
||||
@@ -335,7 +335,7 @@ public:
|
||||
CatMapHash ofshash;
|
||||
|
||||
AutoBuffer<uchar> buf(nsamples);
|
||||
Mat non_missing(layout == ROW_SAMPLE ? Size(1, nsamples) : Size(nsamples, 1), CV_8U, (uchar*)buf);
|
||||
Mat non_missing(layout == ROW_SAMPLE ? Size(1, nsamples) : Size(nsamples, 1), CV_8U, buf.data());
|
||||
bool haveMissing = !missing.empty();
|
||||
if( haveMissing )
|
||||
{
|
||||
|
||||
@@ -285,13 +285,13 @@ int KDTree::findNearest(InputArray _vec, int K, int emax,
|
||||
CV_Assert(K > 0 && (normType == NORM_L2 || normType == NORM_L1));
|
||||
|
||||
AutoBuffer<uchar> _buf((K+1)*(sizeof(float) + sizeof(int)));
|
||||
int* idx = (int*)(uchar*)_buf;
|
||||
int* idx = (int*)_buf.data();
|
||||
float* dist = (float*)(idx + K + 1);
|
||||
int i, j, ncount = 0, e = 0;
|
||||
|
||||
int qsize = 0, maxqsize = 1 << 10;
|
||||
AutoBuffer<uchar> _pqueue(maxqsize*sizeof(PQueueElem));
|
||||
PQueueElem* pqueue = (PQueueElem*)(uchar*)_pqueue;
|
||||
PQueueElem* pqueue = (PQueueElem*)_pqueue.data();
|
||||
emax = std::max(emax, 1);
|
||||
|
||||
for( e = 0; e < emax; )
|
||||
@@ -433,7 +433,7 @@ void KDTree::findOrthoRange(InputArray _lowerBound,
|
||||
|
||||
std::vector<int> idx;
|
||||
AutoBuffer<int> _stack(MAX_TREE_DEPTH*2 + 1);
|
||||
int* stack = _stack;
|
||||
int* stack = _stack.data();
|
||||
int top = 0;
|
||||
|
||||
stack[top++] = 0;
|
||||
|
||||
@@ -149,7 +149,7 @@ public:
|
||||
int k = std::min(k0, nsamples);
|
||||
|
||||
AutoBuffer<float> buf(testcount*k*2);
|
||||
float* dbuf = buf;
|
||||
float* dbuf = buf.data();
|
||||
float* rbuf = dbuf + testcount*k;
|
||||
|
||||
const float* rptr = responses.ptr<float>();
|
||||
|
||||
@@ -241,8 +241,8 @@ public:
|
||||
}
|
||||
// allocate memory and initializing headers for calculating
|
||||
cv::AutoBuffer<double> _buffer(nvars*2);
|
||||
double* _diffin = _buffer;
|
||||
double* _diffout = _buffer + nvars;
|
||||
double* _diffin = _buffer.data();
|
||||
double* _diffout = _buffer.data() + nvars;
|
||||
Mat diffin( 1, nvars, CV_64FC1, _diffin );
|
||||
Mat diffout( 1, nvars, CV_64FC1, _diffout );
|
||||
|
||||
|
||||
@@ -1579,7 +1579,7 @@ public:
|
||||
return;
|
||||
|
||||
AutoBuffer<double> vbuf(var_count);
|
||||
double* v = vbuf;
|
||||
double* v = vbuf.data();
|
||||
Mat new_sv(df_count, var_count, CV_32F);
|
||||
|
||||
vector<DecisionFunc> new_df;
|
||||
@@ -1914,7 +1914,7 @@ public:
|
||||
int class_count = !svm->class_labels.empty() ? (int)svm->class_labels.total() : svmType == ONE_CLASS ? 1 : 0;
|
||||
|
||||
AutoBuffer<float> _buffer(sv_total + (class_count+1)*2);
|
||||
float* buffer = _buffer;
|
||||
float* buffer = _buffer.data();
|
||||
|
||||
int i, j, dfi, k, si;
|
||||
|
||||
|
||||
+12
-12
@@ -417,7 +417,7 @@ int DTreesImpl::findBestSplit( const vector<int>& _sidx )
|
||||
int splitidx = -1;
|
||||
int vi_, nv = (int)activeVars.size();
|
||||
AutoBuffer<int> buf(w->maxSubsetSize*2);
|
||||
int *subset = buf, *best_subset = subset + w->maxSubsetSize;
|
||||
int *subset = buf.data(), *best_subset = subset + w->maxSubsetSize;
|
||||
WSplit split, best_split;
|
||||
best_split.quality = 0.;
|
||||
|
||||
@@ -488,7 +488,7 @@ void DTreesImpl::calcValue( int nidx, const vector<int>& _sidx )
|
||||
// misclassified samples with cv_labels(*)==j.
|
||||
|
||||
// compute the number of instances of each class
|
||||
double* cls_count = buf;
|
||||
double* cls_count = buf.data();
|
||||
double* cv_cls_count = cls_count + m;
|
||||
|
||||
double max_val = -1, total_weight = 0;
|
||||
@@ -592,7 +592,7 @@ void DTreesImpl::calcValue( int nidx, const vector<int>& _sidx )
|
||||
}
|
||||
else
|
||||
{
|
||||
double *cv_sum = buf, *cv_sum2 = cv_sum + cv_n;
|
||||
double *cv_sum = buf.data(), *cv_sum2 = cv_sum + cv_n;
|
||||
double* cv_count = (double*)(cv_sum2 + cv_n);
|
||||
|
||||
for( j = 0; j < cv_n; j++ )
|
||||
@@ -646,7 +646,7 @@ DTreesImpl::WSplit DTreesImpl::findSplitOrdClass( int vi, const vector<int>& _si
|
||||
const int* sidx = &_sidx[0];
|
||||
const int* responses = &w->cat_responses[0];
|
||||
const double* weights = &w->sample_weights[0];
|
||||
double* lcw = (double*)(uchar*)buf;
|
||||
double* lcw = (double*)buf.data();
|
||||
double* rcw = lcw + m;
|
||||
float* values = (float*)(rcw + m);
|
||||
int* sorted_idx = (int*)(values + n);
|
||||
@@ -717,7 +717,7 @@ void DTreesImpl::clusterCategories( const double* vectors, int n, int m, double*
|
||||
int iters = 0, max_iters = 100;
|
||||
int i, j, idx;
|
||||
cv::AutoBuffer<double> buf(n + k);
|
||||
double *v_weights = buf, *c_weights = buf + n;
|
||||
double *v_weights = buf.data(), *c_weights = buf.data() + n;
|
||||
bool modified = true;
|
||||
RNG r((uint64)-1);
|
||||
|
||||
@@ -819,12 +819,12 @@ DTreesImpl::WSplit DTreesImpl::findSplitCatClass( int vi, const vector<int>& _si
|
||||
base_size += mi;
|
||||
AutoBuffer<double> buf(base_size + n);
|
||||
|
||||
double* lc = (double*)buf;
|
||||
double* lc = buf.data();
|
||||
double* rc = lc + m;
|
||||
double* _cjk = rc + m*2, *cjk = _cjk;
|
||||
double* c_weights = cjk + m*mi;
|
||||
|
||||
int* labels = (int*)(buf + base_size);
|
||||
int* labels = (int*)(buf.data() + base_size);
|
||||
w->data->getNormCatValues(vi, _sidx, labels);
|
||||
const int* responses = &w->cat_responses[0];
|
||||
const double* weights = &w->sample_weights[0];
|
||||
@@ -991,7 +991,7 @@ DTreesImpl::WSplit DTreesImpl::findSplitOrdReg( int vi, const vector<int>& _sidx
|
||||
|
||||
AutoBuffer<uchar> buf(n*(sizeof(int) + sizeof(float)));
|
||||
|
||||
float* values = (float*)(uchar*)buf;
|
||||
float* values = (float*)buf.data();
|
||||
int* sorted_idx = (int*)(values + n);
|
||||
w->data->getValues(vi, _sidx, values);
|
||||
const double* responses = &w->ord_responses[0];
|
||||
@@ -1053,7 +1053,7 @@ DTreesImpl::WSplit DTreesImpl::findSplitCatReg( int vi, const vector<int>& _sidx
|
||||
int mi = getCatCount(vi);
|
||||
|
||||
AutoBuffer<double> buf(3*mi + 3 + n);
|
||||
double* sum = (double*)buf + 1;
|
||||
double* sum = buf.data() + 1;
|
||||
double* counts = sum + mi + 1;
|
||||
double** sum_ptr = (double**)(counts + mi);
|
||||
int* cat_labels = (int*)(sum_ptr + mi);
|
||||
@@ -1148,7 +1148,7 @@ int DTreesImpl::calcDir( int splitidx, const vector<int>& _sidx,
|
||||
if( mi <= 0 ) // split on an ordered variable
|
||||
{
|
||||
float c = split.c;
|
||||
float* values = buf;
|
||||
float* values = buf.data();
|
||||
w->data->getValues(vi, _sidx, values);
|
||||
|
||||
for( i = 0; i < n; i++ )
|
||||
@@ -1169,7 +1169,7 @@ int DTreesImpl::calcDir( int splitidx, const vector<int>& _sidx,
|
||||
else
|
||||
{
|
||||
const int* subset = &w->wsubsets[split.subsetOfs];
|
||||
int* cat_labels = (int*)(float*)buf;
|
||||
int* cat_labels = (int*)buf.data();
|
||||
w->data->getNormCatValues(vi, _sidx, cat_labels);
|
||||
|
||||
for( i = 0; i < n; i++ )
|
||||
@@ -1372,7 +1372,7 @@ float DTreesImpl::predictTrees( const Range& range, const Mat& sample, int flags
|
||||
int i, ncats = (int)catOfs.size(), nclasses = (int)classLabels.size();
|
||||
int catbufsize = ncats > 0 ? nvars : 0;
|
||||
AutoBuffer<int> buf(nclasses + catbufsize + 1);
|
||||
int* votes = buf;
|
||||
int* votes = buf.data();
|
||||
int* catbuf = votes + nclasses;
|
||||
const int* cvidx = (flags & (COMPRESSED_INPUT|PREPROCESSED_INPUT)) == 0 && !varIdx.empty() ? &compVarIdx[0] : 0;
|
||||
const uchar* vtype = &varType[0];
|
||||
|
||||
Reference in New Issue
Block a user