I have a Bag Of Words dictionary created on my computer and saved to xml file. I'm creating an app for Android and I need to use it. Unfortunately according to Andrey Smorodov's answer it turns out that I can't use the OpenCV FileStorage class, for some reason. Do you have any idea what approach should I use? Can you give an example or reference? Also I'm going to use SVM, so will I have problem with svm.load("classifier.xml")? I'm using Android NDK but I don't mind if I should do this in Java.
Asked
Active
Viewed 1,262 times
2
-
`Unfortunately I found out that I can't use the OpenCV FileStorage class, for some reason.` What is that reason? – BlamKiwi Feb 10 '15 at 20:56
-
svm.load() [should work](http://docs.opencv.org/java/org/opencv/ml/CvStatModel.html#load(java.lang.String)). what does *not* work here, is opening an arbitrary Filestorage, and reading Mat's from that. (unless you outsource that to jni) – berak Feb 10 '15 at 21:02
-
So you tell me that I can use FileStorage without problem if I use it in my native part? – dephinera Feb 10 '15 at 21:05
-
haven't tried, but i guess, very much so. themain obstacle (in java) is just, that there are no overloaded operators like '>>' . but no prob in c++ ! – berak Feb 10 '15 at 21:07
-
1Ok, thank you! I'll try and will write here after that. – dephinera Feb 10 '15 at 21:09
2 Answers
1
So I successfully used FileStorage in the native code. I read my files properly. Don't forget to add the READ_EXTERNAL_STORAGE permission in the manifest. (Like @Ken said)

dephinera
- 3,703
- 11
- 41
- 75
1
I was also having trouble with FileStorage in native code. I was getting a SIGABRT crash with no useful message. The solution for me was to add READ_EXTERNAL_STORAGE to the permissions in my AndroidManifest.xml. Now it works just fine.

Ken
- 309
- 2
- 11