I am trying to write an android applications witch calculates keypoints and descriptors using opencv and store them. However i am getting troubles with cv:FileStorage. I am actually passing the file path throw native methods. The same path (different file ending) is also used to store another file on the javaside.
JNIEXPORT void JNICALL Java_com_..._CalcFeatures(JNIEnv* env, jobject, jlong addrGray, jstring location){
...
const char *nativeString = env->GetStringUTFChars(location, NULL);
string filepath=string(nativeString);
FileStorage fs(filepath, FileStorage::WRITE);
fs<<"frameCount"<<5;
fs.release();
...
}
LogCat output:
Fatal signal 11 (SIGSEGV) at 0x000009f4 (code=19), thread 23789
I also tryed to hardcode the path (like „/sdcard/test.xml“ or „/storage/emulated/0/text.xml“). If I am using “test.xml” as filepath, I don’t get any errors, but I am not able to find the file on my phone (HTC One).
Any advices?
Thanks for your time.
UPDATE:
this works just fine, so there is a problem with FileStorage. Is there any other way in opencv to parse it to an xml/json format? perhaps with string as result?
FILE* file = fopen(nativeString,"w+");
fputs("hello, world\n", file);
fclose(file);