OpenCV - Android increase FPS face detection

asked 2018-08-04 08:09:45 -0600

JamesTrix gravatar image

So I've been trying to increase the FPS with OpenCv JavaCameraView with 1280x960 as resolution. I've been trying to find a solution to this but with no luck. I am only getting 3 FPS when trying to do face-eye detection. I am using JNI to compile native c++ code for OpenCV with haarcascade. Is there any way to increase this? or is OpenCV just not suited for this task?

Any suggestions would be appreciated.

I am using this part for the JNI; https://docs.opencv.org/2.4/doc/tutor...

And this for the Java camera part; https://gist.github.com/wllmtrng/e874...

edit retag flag offensive close merge delete

Comments

try to increase minSize for example face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(120, 120) );

sturkmen gravatar imagesturkmen ( 2018-08-04 09:29:09 -0600 )edit

This code didn't have any effect on the FPS perfomance.. Didn't work.

JamesTrix gravatar imageJamesTrix ( 2018-08-04 10:30:14 -0600 )edit

you can easily test it. open this OpenCV.js Tutorial and change the line classifier.detectMultiScale(gray, faces, 1.1, 3, 0); to classifier.detectMultiScale(gray, faces, 1.1, 3, 0, new cv.Size(120,120)); and push start button

sturkmen gravatar imagesturkmen ( 2018-08-04 13:36:12 -0600 )edit

I get what you mean, but it dosen't work when I run it in my android application with JNI. The OpenCv.js tutorial is already on 20+ fps.. I only have 3 fps.

JamesTrix gravatar imageJamesTrix ( 2018-08-04 13:51:43 -0600 )edit

did you try the tutorial with your android device?

sturkmen gravatar imagesturkmen ( 2018-08-04 13:58:36 -0600 )edit

No I copied to code into my JNI .cpp file? Should that do any difference?

JamesTrix gravatar imageJamesTrix ( 2018-08-04 14:21:09 -0600 )edit

you said "The OpenCv.js tutorial is already on 20+ fps." is this true for android ?

sturkmen gravatar imagesturkmen ( 2018-08-04 14:24:09 -0600 )edit

I tried it on my desktop* it was atleast 30+ couldn't see exactly but it was high. My bad there forgot to mention I tried it out first on desktop. - No I have still not been able to get higher than 3 fps on my android

JamesTrix gravatar imageJamesTrix ( 2018-08-04 14:36:30 -0600 )edit