Android eyes detection

asked 2015-07-16 14:19:16 -0500

NathanAP gravatar image

updated 2015-07-16 15:32:02 -0500

Hello guys, Im REALLY new with OpenCV and Im trying to learn how to use it. I'm doing a little project to my college and I need to use OpenCV to detect both eyes (open) from people, the return need to be true/false. I know it might be simple, but Im not sure if Im going in the right way. Im using Android Studio and I dont know if I made the right import: I found an tutorial that made me create a "libraries" folder and a "src/main/jniLibs" to copy files from "opencv/java" folder, it works well, but I dont have those "haarcascade" .xml (from"etc" folder) imported, that seems I need to use. Can you guys help me with this? I really want to learn how to use it, but people on Google and Stackflow need OpenCV for big issues, while I need a true/false return. Thanks!

Edit: forgot to say that Im using it with a bitmap object that will not be saved in sdcard (people clicks in a button in a SurfaceView and OpenCV try to find eyes). I dont know if it changes much, but its a important thing to remember.

edit retag flag offensive close merge delete


i guess, you'll encounter some more problems, but all the cascade files are here :

berak gravatar imageberak ( 2015-07-16 14:29:52 -0500 )edit

Yeah, I have all those in etc folder. So I just put them inside libs folder?

NathanAP gravatar imageNathanAP ( 2015-07-16 15:06:03 -0500 )edit

hmm, might just be, you're missing the real probem behind it: the CascadeClassifier can't read from a zip/apk, so you have to copy your *cascade.xml to sdcard before you can use it.

berak gravatar imageberak ( 2015-07-16 15:13:45 -0500 )edit

Oh, I see... So I need it in my app and in phone sdcard? (Now that you said this, I forgot to say something important in main question. I will edit it)

NathanAP gravatar imageNathanAP ( 2015-07-16 15:29:09 -0500 )edit

well, you're probably supposed to distribute it along (inside) with your apk, but then, you have to copy it. e.g., - have a look here

berak gravatar imageberak ( 2015-07-16 15:37:09 -0500 )edit

So I verify if those files exist in sdcard, otherwise I create them from my own apk, right? Well, I could do it before loads the activity where my surfaceview is.

NathanAP gravatar imageNathanAP ( 2015-07-16 15:51:00 -0500 )edit