1
我用g ++收到以下錯誤奇怪的錯誤:通過G ++
wormAlgo.cpp: In function ‘void svm(cv::Mat&, cv::Mat&, cv::Mat&, cv::Mat&)’:
wormAlgo.cpp:146:8: error: expected unqualified-id before numeric constant
wormAlgo.cpp:146:8: error: expected ‘;’ before numeric constant
我的代碼是這樣的:
void svm(cv::Mat& trainingData, cv::Mat& trainingClasses, cv::Mat& testData, cv::Mat& testClasses)
{
CvSVMParams param = CvSVMParams();
param.svm_type = CvSVM::C_SVC;
param.kernel_type = CvSVM::RBF; //CvSVM::RBF, CvSVM::LINEAR ...
param.degree = 0; // for poly
param.gamma = 20; // for poly/rbf/sigmoid
param.coef0 = 0; // for poly/sigmoid
param.C = 7.0; // for CV_SVM_C_SVC, CV_SVM_EPS_SVR and CV_SVM_NU_SVR
param.nu = 0.0; // for CV_SVM_NU_SVC, CV_SVM_ONE_CLASS, and CV_SVM_NU_SVR
param.p = 0.0; // for CV_SVM_EPS_SVR
param.class_weights = NULL; // for CV_SVM_C_SVC
param.term_crit.type = CV_TERMCRIT_ITER +CV_TERMCRIT_EPS;
param.term_crit.max_iter = 1000;
param.term_crit.epsilon = 1e-6;
在管線146代碼param.C = 7.0; // for CV_SVM_C_SVC, CV_SVM_EPS_SVR and CV_SVM_NU_SVR
能否請你幫我。
能告訴你的'CvSVMParams'類的代碼?至少是'CvSVMParams :: C'成員的聲明...... –
無關,但你不需要'= CvSVMParams();'部分 –
@TomasLycken那部分來自opencv。我懷疑這是否有任何問題。 – Chani