How to generate xml file of svm classifier using opencv3.0-beta

asked 2015-04-03 09:51:14 -0500

runner gravatar image

updated 2015-04-03 10:34:22 -0500

In opencv3.0, we can code like following to train svm classifier.

Ptr<SVM> svm = StatModel::train<SVM>(trainingDataMat, ROW_SAMPLE, labelsMat,params);

However,there is no way to save the result as xml file. In the early version, we can use svm.save("svm.xml") to save the result. It's so convenient. So I want to know how to generate xml file of svm classifier using opencv3.0-beta. Thank you for your suggestions!

edit retag flag offensive close merge delete

Comments

sure you can use svm->save() and svm->load() ! why do you think, it's not possible ?

berak gravatar imageberak ( 2015-04-04 08:22:12 -0500 )edit

Yeah. Because when I try to use svm.save(), I can't find the function. Maybe there is no this function in opencv3.0-beta. I'm also very confused.

runner gravatar imagerunner ( 2015-04-04 10:28:26 -0500 )edit

can it be, you're just missing the pointer ? again, svm->save(), not svm.save()

http://docs.opencv.org/ref/master/db/...

berak gravatar imageberak ( 2015-04-04 10:41:05 -0500 )edit

Yes. You are right! Thank you for your help.

runner gravatar imagerunner ( 2015-04-05 23:45:15 -0500 )edit