Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers.
Welcome to JeVois Tech Zone, where you can ask questions and receive answers from other members of the community.

load xml.file of svm model to smart pointer

0 votes

Hi! I am trying to implement a handwritten digits and character recognition code to Jevois camera in C++. The algorithm I am using in OpenCV is svm. In order to save the processing time, I want to load the trained model by using:

Ptr<SVM> svm1 = cv::ml::SVM::load("8.xml");   

(I have copied the file 8.xml to the same path as the .C file) .

so that I can use: svm->predict() later to do the prediction for the testing video.

 However when I try to cross compile and run the camera, I see following error in the guvcview: Caught std::exception (....path/opencv2/core.hpp:3142:error (-215 fs.isOpened in function load). There is no error during the cross-compling and these commands work fine in Opencv without Jevois framework (processing video etc.). Is this kind of operation possible? If so where did I do wrong?

Under Jevois framework I am able to read xml.file using the cv::FileStorage Class by using sth like (cv::FileStorage fsClassifications(filename, cv::FileStorage::READ);), while I am not sure how to import data from it and apply it to the svm->predict()

Could you maybe give me a hint on that?

Thanks in advance!

asked May 9 in Programmer Questions by yoann747 (250 points)

1 Answer

+1 vote
Best answer
Great timing, I think your question is related to this one: http://jevois.org/qa/index.php?qa=1996

In your case, you should copy your XML file to your module's source code directory. Then use the absolutePath() function as described in this other post.

After you rebuild for platform and flash to microSD, confirm that your XML file was copied to the same place as the .so file of your module: SDCARD:/jevois/modules/Vendor/YourModule/

Then the error you were getting when trying to open it should go away.
answered May 9 by JeVois (20,780 points)
selected May 11 by yoann747
Thanks! It works!