Closed ShahkarHassan closed 4 years ago
To start off, the following modifications were done in the 'people-counter' code to detect and count groups passing through the entrance. In the first screenshot (i.e the group detection function) we can see that it takes 4 arguments as the input which are actually two centre coordinates of any two bounding boxes around individual people with which the distance between the points is stored in the 'dist' variable using the mathematical formula for distance. With the help of this dist variable we apply an if-else construct in which if the distance is less than 58, the function returns 1. Otherwise if the distance is greater than 100 or if one of the points are equal to (0,0) (i.e one bounding box is present at one time in the frame indicating one person walking individually), the function will return 0. An important thing to note that is that the distance values were selected after a process of hit and trial that gave the best results in the output video.
As we shift our focus towards the 2nd screenshot (the while loop for the video), the function is implemented and its clearly shown that if the value is 1, then the variable grpnum (the total group count in the video), is incremented by 1. Some of the screenshots of the output video is shown below where it counts the three groups (i.e 2 or more people walking together in or out the entrance)
Another change was implemented here which was just including the groups text on the left hand corner of the video which is responsible for updating the group count during video playback
Implement the code to detect groups