svm->save() throws SEHException

asked 2016-04-14 14:20:17 -0500

mrlibby gravatar image

I use the ff. code

Mat data;
Mat feature;
hconcat(r_hist.reshape(1, 1), g_hist.reshape(1, 1), feature); //r_hist and g_hist are color histograms
data.push_back(feature);

int label = 1;
Mat labelMat(1, 1, CV_32SC1, label);

Ptr < cv::ml::SVM > svm = SVM::create();
svm->setC(0.01);
svm->setType(ml::SVM::C_SVC);
svm->setKernel(ml::SVM::LINEAR);
svm->setTermCriteria((cvTermCriteria(TermCriteria::MAX_ITER, 100, 1e-6)));
svm->train(data, ROW_SAMPLE, labelMat);
svm->save("svm.xml");

Can somebody help me with this? I use version 3.0.0

edit retag flag offensive close merge delete