From ed934ed6fcda1ec54cc03943661400e3bd58dc1c Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Mon, 6 Dec 2010 19:42:16 +0000 Subject: [PATCH] fixed GBTrees build on NetBSD & Android; fixed GPU brute force matcher test build on MacOSX --- modules/ml/src/gbt.cpp | 26 +++++++++++--------------- tests/gpu/src/brute_force_matcher.cpp | 17 +++++++++-------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/modules/ml/src/gbt.cpp b/modules/ml/src/gbt.cpp index 2b8959f..259550f 100644 --- a/modules/ml/src/gbt.cpp +++ b/modules/ml/src/gbt.cpp @@ -11,10 +11,6 @@ using namespace std; #define CV_CMP_FLOAT(a,b) ((a) < (b)) static CV_IMPLEMENT_QSORT_EX( icvSortFloat, float, CV_CMP_FLOAT, float) -#if ANDROID -#define expl(x) exp(x) -#endif - //=========================================================================== string ToString(int i) { @@ -461,17 +457,17 @@ void CvGBTrees::find_gradient(const int k) { for (int i=0; icols > sample_idx->rows) ? 1 : sample_idx->step/CV_ELEM_SIZE(sample_idx->type); int idx = *(sample_data + subsample_data[i]*s_step); for (int j=0; jcols]; - res = expl(res); + res = exp(res); if (j == k) exp_fk = res; exp_sfi += res; } @@ -625,7 +621,7 @@ void CvGBTrees::change_values(CvDTree* tree, const int _k) float CvGBTrees::find_optimal_value( const CvMat* _Idx ) { - long double gamma = (long double)0.0; + double gamma = (double)0.0; int* idx = _Idx->data.i; float* resp_data = orig_response->data.fl; @@ -639,7 +635,7 @@ float CvGBTrees::find_optimal_value( const CvMat* _Idx ) { for (int i=0; iresponses->data.fl; - long double tmp1 = 0; - long double tmp2 = 0; - long double tmp = 0; + double tmp1 = 0; + double tmp2 = 0; + double tmp = 0; for (int i=0; i using namespace cv; using namespace cv::gpu; @@ -149,19 +150,19 @@ private: copy(knnMatches[i].begin(), knnMatches[i].end(), back_inserter(matches)); } + struct DMatchEqual : public binary_function + { + bool operator()(const DMatch& m1, const DMatch& m2) const + { + return m1.imgIdx == m2.imgIdx && m1.queryIdx == m2.queryIdx && m1.trainIdx == m2.trainIdx; + } + }; + static bool compareMatches(const vector& matches1, const vector& matches2) { if (matches1.size() != matches2.size()) return false; - struct DMatchEqual : public binary_function - { - bool operator()(const DMatch& m1, const DMatch& m2) - { - return m1.imgIdx == m2.imgIdx && m1.queryIdx == m2.queryIdx && m1.trainIdx == m2.trainIdx; - } - }; - return equal(matches1.begin(), matches1.end(), matches2.begin(), DMatchEqual()); } -- 2.7.4