Ask Your Question

Duration of Face detection

asked 2013-02-28 03:15:55 -0500

Chakan gravatar image


Just started using the opencv 2.4.4 got the face tracking and detection to work fine along with the eye (with glasses detection). This is using the samples provided.

My next question is how do I track the amount of time the face is being detected along with the eyes?

Basically what I need to do is start a timer when they eyes are detected and when they are no longer detected calculate the timespan between the 2 instances?

Is there any sample code that does this so I can have a look how it's done?


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-02-28 04:04:17 -0500

berak gravatar image

updated 2013-02-28 04:05:16 -0500

i'm using opencv's timing functions for that:

int64 t0 = cv::getTickCount();
// do something
int64 t1 = cv::getTickCount();
doubles seconds = double( t1 - t0 ) / cv::getTickFrequency();
cerr << "took : " << seconds << endl;
edit flag offensive delete link more


Thanks will look into this!

Chakan gravatar imageChakan ( 2013-02-28 04:38:12 -0500 )edit

Hi A follow up question, does OpenCV already have built into the framework a variable that tracks the time the face was detected? So it detects a face at 1:05:05 and then doesn't detect the same face at 1:05:20 which would mean it duration of detection was 20 seconds?

Is there a variable built into the face detection module already?

Chakan gravatar imageChakan ( 2013-02-28 23:42:29 -0500 )edit

ah, no. not builtin. you've got to do this yourself. but it makes kinda sense, i say

berak gravatar imageberak ( 2013-03-01 01:28:38 -0500 )edit

Ok thanks, just checking that it wasn't there already. Will work on getting it sorted.

Chakan gravatar imageChakan ( 2013-03-01 02:12:51 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2013-02-28 03:15:55 -0500

Seen: 180 times

Last updated: Feb 28 '13