Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to count person in video?

I am use opencv 2.4.9 and python 2.7.6, I need to count people in video. What I already did is:

  1. Background subtraction
  2. Find contour and put the bounding box
  3. Find the centroid (cx,cy)
  4. Draw a virtual line at (20,75) to (320,75)

I am trying to count people, when they cross the line. I try this code to count it

if 75 <= cy <=77:
   counter=counter+1

no error, but the counter count it double, Is there other way to count it?