Skip to content

Chris0325/PedestrainTracking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✨✨PedestrainTracking ✨✨

This is a C++ reimplementation and refinement of blacksteed232's PedestrianCounter with tracking in mind.

Requirements

  • Opencv

Improvements

  • Instead of counting how many people walking across a straight line, here we can specify arbitrary closed polygon region and count the number of people entering or exiting from it.

  • We eliminate the constraint that a person can only come inside or go outside of scene from either the top or the bottom edges, and allow entering and exiting from any location on the boudary.

  • When perfoming cv::Camshift, we provide two options, namely tracking by grey-scale value or tracking by hue value. It turns out that tracking by hue value is more stable than the other approach.

  • New data members momentOnTrack, which is the miliseconds offset from the beginning of the input video and records the exact moment a person appears on track, and trackings, which is of type std::vector<cv::Point2i>> and records trojectories of each individual, are added to class People. Right before deleting each People object, you can store their tracking info into whichever database you prefer.

  • We use double-linked list data structure to dynamically organize the list of People objects. Unlike removing objects directly in the middle of a Python list in PedestrianCounter, our approach is undoubtly more efficient.

Examples

We correctly identify the trojectories of 3 out of 4 persons ever across our pre-defined region.

Console Output

screenshot from 2018-01-25 19-01-13

As you can see, we identify 10 persons in total. The number on the right of each line is the bounding box area whenever a person leaves the scene.