I have a problem in my native code because in my c ++ code I can not save the images I receive from the JAVA part.
I tried using cv::imwrite
but the image is never saved in the path and in the corresponding folder.
My JNI code is as follows:
extern "C"{
JNIEXPORT jintArray JNICALL Java_com_example_testNativeCode_DisplayImage_FindFeatures(JNIEnv* env, jclass obj, jintArray bufImg, jint w, jint h){
jint *cbuf;
cbuf = env->GetIntArrayElements(bufImg, 0);
if(cbuf==NULL){
return 0;
}
cv::Mat mImg(h,w,CV_8UC4, (unsigned char*)cbuf);
cv::imwrite("../SaveImage/img.png", mImg);
}
}
I use android studio 2.3.3 and OpenCv 3.1.0. I put in the manifest:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
I want to know if it was possible to record an image with cv::imwrite
?
How else can I do to save it?