OpenCV Error: Assertion failed (samples.cols == var_count && samples.type() == CV_32F) in predict, file C:/repo/mingw-w64-opencv/src/opencv-3.2.0/modules/ml/src/svm.cpp, line 1930
vector<int> Idx {1,2,3,4,5,6,7,8,9,10,11,13};//0,1,2,3,4,5,6,7,8,9,10,11,12,13; (14 features)
Mat varIdx(Idx);
Ptr<TrainData> _Samples = TrainData::create(Train, ROW_SAMPLE, TrainResp, _Params.getVarIdx());
Ptr<NormalBayesClassifier> normalBayesClassifier = StatModel::train<NormalBayesClassifier>(_Samples);
normalBayesClassifier->predict(Test, results);
......
svm->trainAuto(_Samples);
svm->predict(Test, results);// error
the varidx for svm doesnot work, but for Bayes it works, at least the program doesnot crash. I checked some answers from google, someone said varidx should be like this {0,1,1,1,1,0,1...}, it is so strange, i cannot believe it.