简体   繁体   中英

android/opencv - load cascade files from app folder in NDK

I'm writing an android app which does face detection in native code using OpenCV. Right now, I save lbpcascade_frontalface.xml in SD card and load it in NDK/C++ as below.

CascadeClassifier fc.load("absolute path to sd card/Downloads/lbpcascade_frontalface.xml");

However, I want to save it in the app package, may be in assets/res folder. Does anyone know how can I load it in C++/NDK? Rather how can i get the absolute path to this file if I need to save it somewhere in the app package itself?

opencv can't read from zip files directly.

so if you put the cascade into your apk, you'll have to load it and save it again to internal/external storage, like in the facedetect sample

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM