How can I load a file using CvFileStorage but on android with native code?

asked 2012-09-22 15:36:16 -0500

ZachTM gravatar image

Hi guys. I want to reuse some of my C++ code on android for my neural network. I made use of CvFileStorage to store the weights of the neural network which works great. So I have this code:

CvANN_MLP network;

CvFileStorage* fs = cvOpenFileStorage("Neurons", 0, CV_STORAGE_READ);
CvFileNode* node = cvGetFileNodeByName(fs, NULL , "OCRNN");
network.read(fs,node);
cvReleaseFileStorage(&fs);

This "Neurons" file would just be in the same directory of the executable. As i said it worked great so I want to use this code in android using native code. But I do not know where to put the Neurons file in the APK. If i put it in the root directory of the apk I get the following error:

OpenCV error: Null Pointer (Invalid pointer to file storage.)

I expected this to happen but I dont know how to fix it. Does anyone know where I can put this file in my apk and how I can load it from native code? Thanks!

edit retag flag offensive close merge delete