0

I want to count number of faces in video comes, like if I am standing in front of camera then count=1, now any other person come in front of camera count=2, If I again come back to the camera now the count=3 like so.

What I was doing is, using frontal_face_haarcascade.xml opencv and python I am able to detect faces in frame and then find the total number of bounding rectangles around the face, in the frame then increase the count, but What's happening the count increasing as the number of frames.

How can I overcome this problem.

  • use some kind of tracking and dont count detections that fall in a tracked area. – Micka Jan 11 '17 at 07:18
  • Tracking, can you please elaborate? – Aaquib javed khan Jan 11 '17 at 08:27
  • opencv has a TLD tracker, see for example: https://www.youtube.com/watch?v=SPUvKtlp6oE – Micka Jan 11 '17 at 08:34
  • But while detecting face using frontal_face_haarcascade.xml rectangular bounding box also tracks the face around the whole image. so what I am thinking to do is, I will use dlib or TLD tracker to track the same bounding box, so when ever it tracks increase the number or count. Will this work? – Aaquib javed khan Jan 11 '17 at 10:42
  • while it tracks DONT increase the count. Only start new TLD tracking and increase the count if a new detection doesn't fall in a already tracked area. And drop tracks that are not in the image anymore. – Micka Jan 11 '17 at 10:56
  • @Aaquibjavedkhan , hey bro were you able to get the count properly. Please enlighten me with the method you followed – Mueez Siraj Mar 21 '18 at 14:30

0 Answers0