Ask Your Question

cascade.xml in Android APK

asked 2012-09-10 03:49:59 -0500

Bia6969 gravatar image

updated 2012-09-10 06:56:36 -0500

Andrey Pavlenko gravatar image

Hi!! I've finished my object detection android app and i want to run it on a real device. My problem is: the access to the cascade.xml file has been done through a virtual sdcard, i mean, i created a virtual sd card and pushed the xml file into it so the access to it was a simple line on the native code part:

 std::string cascade_name= "sdcard/cascade.xml";

On a real device i don't want to copy the file into the sdcard, i want it to be included on the apk. To do that, i've copied the file into the assets folder. The question is, how do i access it from the native code?

std::string cascade_name= "assets/cascade.xml";

I tried this but nothing happened which makes me think it's not the right path to assets folder. SO where's the right folder in which i should put cascade.xml ?

Any help would be appreciated, Thanks!

edit retag flag offensive close merge delete



@Bia6969 did find the way? then please post here

Sameer gravatar imageSameer ( 2013-10-07 23:30:17 -0500 )edit

same. Did you find a way? what is best practice?

ozzyoli gravatar imageozzyoli ( 2013-12-06 18:09:54 -0500 )edit

I believe the best practice is to use Java code for assets extraction (like the OpenCV sample does). But if you really need it in JNI, try the approach mentioned at

Andrey Pavlenko gravatar imageAndrey Pavlenko ( 2013-12-13 07:58:00 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2012-09-10 06:53:59 -0500

Andrey Pavlenko gravatar image

Look at the face-detection sample from OpenCV4Android SDK, it does exactly what you need.

edit flag offensive delete link more



not exactly. On face-detection sample the detection happens on the java side, i wanted to load the cascade and detection on the native code side. Is it possible?

Bia6969 gravatar imageBia6969 ( 2012-09-10 07:56:56 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2012-09-10 03:49:59 -0500

Seen: 866 times

Last updated: Sep 11 '12