I'm testing the creation of the Android apps integrating C++ code. In this example I'm using the OpenCV library
I setup the environment and I was also able to compile and deploy. The app works correctly. Beautiful until here. There is a little UX problem though. The app makes use of two xml files:
haarcascade_frontalface_alt.xml
haarcascade_eye_tree_eyeglasses.xml
but at the moment the final user needs to post-download them on device and in a given folder, otherwise the app would be unable to perform the respective detections. The significant part of code so far is the following:
JNIEXPORT void JNICALL Java_com_demo_test_opencvsample_OpenCVClass_faceDetection
(JNIEnv *, jclass, jlong addrRgba){
Mat& frame = *(Mat*)addrRgba;
detect(frame);
}
void detect(Mat& frame){
// these files will be loaded from a specific folder in the phone memory
String face_cascade_name = "/storage/emulated/0/data/haarcascade_frontalface_alt.xml";
String eyes_cascade_name = "/storage/emulated/0/data/haarcascade_eye_tree_eyeglasses.xml";
CascadeClassifier face_cascade;
CascadeClassifier eyes_cascade;
//-- 1. Load the cascades
if( !face_cascade.load( face_cascade_name ) ){ printf("--(!)Error loading\n"); return; };
if( !eyes_cascade.load( eyes_cascade_name ) ){ printf("--(!)Error loading\n"); return; };
-> question: is there a way to integrate the two xml files directly in the apk avoiding a final user to have to download them separately on his device after the installation of the app? I would like him to have them directly available after the app gets installed and the C++ code, also because they are not supposed to be changed
NOTE before answering: I'm not interested in putting two download buttons in the final app and not even in having a full-android solution. I would like to maintain the current architecture making use of the C++ core
Thanks in advance to those who will try to help