Add Macro to decide using ocl method or not.

This commit is contained in:
Baichuan Su
2013-11-11 11:46:07 +08:00
committed by Ilya Lavrenov
parent 00300baa53
commit 2cf16db683
2 changed files with 9 additions and 6 deletions

View File

@@ -5,6 +5,7 @@
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/ml/ml.hpp"
#ifdef HAVE_OPENCV_OCL
#define _OCL_SVM_ 0 //select whether using ocl::svm method or not, default is not
#include "opencv2/ocl/ocl.hpp"
#endif
@@ -2377,7 +2378,7 @@ static void setSVMTrainAutoParams( CvParamGrid& c_grid, CvParamGrid& gamma_grid,
degree_grid.step = 0;
}
#ifdef HAVE_OPENCV_OCL
#if defined HAVE_OPENCV_OCL && _OCL_SVM_
static void trainSVMClassifier( cv::ocl::CvSVM_OCL& svm, const SVMTrainParamsExt& svmParamsExt, const string& objClassName, VocData& vocData,
Ptr<BOWImgDescriptorExtractor>& bowExtractor, const Ptr<FeatureDetector>& fdetector,
const string& resPath )
@@ -2458,7 +2459,7 @@ static void trainSVMClassifier( CvSVM& svm, const SVMTrainParamsExt& svmParamsEx
}
}
#ifdef HAVE_OPENCV_OCL
#if defined HAVE_OPENCV_OCL && _OCL_SVM_
static void computeConfidences( cv::ocl::CvSVM_OCL& svm, const string& objClassName, VocData& vocData,
Ptr<BOWImgDescriptorExtractor>& bowExtractor, const Ptr<FeatureDetector>& fdetector,
const string& resPath )
@@ -2605,7 +2606,7 @@ int main(int argc, char** argv)
for( size_t classIdx = 0; classIdx < objClasses.size(); ++classIdx )
{
// Train a classifier on train dataset
#ifdef HAVE_OPENCV_OCL
#if defined HAVE_OPENCV_OCL && _OCL_SVM_
cv::ocl::CvSVM_OCL svm;
#else
CvSVM svm;