Opencv Face Detection Assign id for each face

asked 2017-03-19 13:59:38 -0500

Lafi gravatar image


I'm using Opencv for face detection from video stream but my problem is how to assign an id for each detected face? for example if in the current frame i have detected 3 faces so i have 3 unique id for each faces, now in the next frame if i have 4 detected faces then i need an other id to assign it to the new face!!!

how i can assign a unique id for each faces?

also how i can preserve the same id for each face and assign a new id for the new detected face?

Thank you


edit retag flag offensive close merge delete



You will need a combination of a prediction algorithm and an assignment algorithm. A kalman filter+Hungarian algorithm for example.

abhijith gravatar imageabhijith ( 2017-03-20 01:37:54 -0500 )edit

please can you provide an example in python?? it will be very helpfullll!! thank you

Lafi gravatar imageLafi ( 2017-03-20 08:16:21 -0500 )edit

Here's a C++ implementation to give you an idea so you can port it to python.

abhijith gravatar imageabhijith ( 2017-03-21 23:39:09 -0500 )edit