How to run faceDetect faster

asked 2015-08-25 12:10:15 -0600

franken gravatar image

Hi i'm a newbie in opencv , i want to run the code faceDetect.cpp in sample folder on a raspberry pi 2 overclocked to 1GHZ , i'm using faceDetect.cpp to detect face and eye gaze

the program is a little bit slow due to the detection i want that the program runs in real time ... the only improvement that i can done is to increase the scale but the accuracy decreases a lot ... is there any alternative that can be done without affecting much the accuracy !!! thanks a lot.

edit retag flag offensive close merge delete



lbp cascades are a factor of 10 faster than haar ones..

also, hate to say that, but is doing the similar thing in 7micros on my arcane 2ghz athlon.

berak gravatar imageberak ( 2015-08-25 12:13:45 -0600 )edit

scaling down of image before detection is a way to speed up. look here

sturkmen gravatar imagesturkmen ( 2015-08-25 16:49:25 -0600 )edit

@berak you're right LBP is faster (a few times faster) but less accurate. (10-20% less than Haar). , for me it's about 5 times faster that's because i use eye detection too with haar classifier using 'haarcascade_eye_tree_eyeglasses.xml' , i have not found an XML file for eye detection using lbpCascade , so what you suggest to do ...

franken gravatar imagefranken ( 2015-08-26 06:45:32 -0600 )edit

do you use a min/max Rect in your detect call ? you could try to limit the search space. or increase the scalefactor. apart from that, no (further) idea.

berak gravatar imageberak ( 2015-08-26 06:53:41 -0600 )edit

@berak like i said if i increase the scale factor the accuracy is gone , yes i can limit the space in detectMultiscale function it's set to 30,30 but it the limit if i decrease it more it will not detect more faces

franken gravatar imagefranken ( 2015-08-26 08:51:10 -0600 )edit

@sturkmen yes it a way to do so but it won't detect the big faces , i am using size(30,30)

franken gravatar imagefranken ( 2015-08-26 08:54:19 -0600 )edit