A method for counting people attending large public events
- First Online:
- Cite this article as:
- Kopaczewski, K., Szczodrak, M., Czyzewski, A. et al. Multimed Tools Appl (2015) 74: 4289. doi:10.1007/s11042-013-1628-0
- 2.2k Downloads
The algorithm for people counting in crowded scenes, based on the idea of virtual gate which uses optical flow method is presented. The concept and practical application of the developed algorithm under real conditions is depicted. The aim of the work is to estimate the number of people passing through entrances of a large sport hall. The most challenging problem was the unpredicted behavior of people while entering the building. The examined flow of people fluctuated between individual persons and dense crowd. A series of experiments during sport and entertainment events was made. The results of the experiments show a high efficiency of the elaborated algorithm.
KeywordsCrowd People counting Crowd behavior
Mass crowd gatherings such as sport games or concerts can be a source of various risks for individuals, particularly evoked by excessive number of people in a specific place. Exceeding the value regarded as the safe limit may cause that in some emergency situations people would suffer injuries or death . The organizers should know the number of people that are gathered in the building or in the enclosed outdoor space. Similarly to many objects of this type, the building considered in this work is not equipped with the people counting systems such as mechanical gates. Besides, people often feel concerned crossing such an installation, as to what would happen in case of necessity of rapid leaving the building. Moreover, the behavior of the crowd while entering an object through wide doors makes it impossible to use other optical or mechanical means such as radiation beam systems. The infrared barriers are ineffective because they often count a group of people being close each to other as a single person . A problem is also that such solutions usually are not able to recognize the pedestrian movement direction.
Aside of video processing algorithms commonly used for surveillance of public places, the audio analysis provides an important supplement . Nevertheless, when a large group of people appears, it gets very hard to determine their number by the majority of image processing methods which commonly use object detection and tracking. Background extraction-based approaches, such as the ones developed at the Multimedia Systems Department of Gdansk University of Technology  cannot separate objects properly when people walk at very small distances or when their hands are connected. Other methods use multiple cameras to deal with the segmentation problem [10, 14, 15], or apply models of human figures obtained during observing the foreground of an image [7, 13]. Moreover, installing numerous cameras would be impractical in the considered building.
Other solutions which utilize camera image together with laser beams for tracking feet, require deploying sensors on the ground .
The commercial systems diverge in the technologies applied and the actual target to solve. A laser counter offered in the market today and visible light systems are very common. These kinds of products often achieve best performance in some specific conditions, only. Meanwhile, the situations found while gathering the experimental data proven to be difficult to interpret algorithmically.
The methods of counting people in crowded scenes can be found in literature.
Albiol et al.  describe a technique based on the analysis of the derivate image constructed from a time sampled section of original image. Another method  uses statistical analysis of object corners detected while people move. Both latter methods were investigated in some specific conditions of underground train doors. Bozzoli et al.  propose an approach based on the sparse optical flow method and pedestrians contours obtaining by edge extraction from the image. However, similarity of such contours in not guaranteed because people may have various hair or clothes colors.
The proposed algorithm for counting people in the crowd differs from described approaches. It uses dense optical flow for motion analysis employing the so called virtual gate. The algorithm is dealing with complex situations which occur while people entering large sport halls. Moreover the algorithm is designed to work in a system with centralized architecture, where the video signals gathered from multiple cameras are being processed by an efficient computer cluster. The aim of the system is to show the estimated number of people while they are incoming to the hall through several gates. The KASKADA supercomputing platform is the algorithm working environment .
2 Virtual gate algorithm
The Virtual Gate algorithm is based on the modified Optical Flow method. The method developed for counting people does not involve classifying modules because the aim of the algorithm is to detect size and direction of motion of objects in video sequences having dimensions similar to the size of an average human body. Moreover, the Virtual Gate is used in places where human motion is expected, especially at entrances, passes, etc. Two parts of algorithm can be distinguished: the main module which performs image processing and the calibration module.
The detailed structure of the Virtual Gate is depicted in Fig. 1b. It is composed of a set of rectangle regions (Ri) situated next to each other and overlapping. Rectangles have identical shape and their size is corresponding to the size of an average human body contour, with respect to its height and width (for a particular camera view). Rectangles are spaced evenly along x axis and they are 80 % overlapped.
- i, j
unit vectors of x and d axes
- eρ, eφ
unit vectors related to polar coordinates (the distance from the axis of symmetry, the angle measured counterclockwise from the positive x-axis).
Two directions of people motion through the virtual gate are considered, namely forward and backward (“in” and “out”, +d and –d, as in Fig. 1c). Moreover, a small divergence of the direction (±α) is allowed, because usually people do not maintain bearing while walking. The tolerance should not be too large, because of the need to discard those walking along the gate.
In the next step, LI and LO are compared to a threshold value TS which is proportional to the average area of human silhouette at a given camera view, the value being obtained experimentally. If L(•) is greater than the threshold value TS, the “in” or “out” people counter is increased and rectangle Ri enters an inactive (“hold”) state for the period of C frames. The inactive state means that calculations are not performed for region Ri. This operation is done in order to avoid counting errors and to allow leaving the area of Ri by the moving object while not being counted more than once. The period of the “hold” state is obtained experimentally during the calibration.
video sequence presenting passage of individuals and groups of people,
the Virtual Gate geometry and parameters (i.e. dimensions of regions Ri, number and distance between regions),
number of people passed through the gate in selected time moments.
number of selected time moments
- pn = p0, p1, …, pN
real number of people passed through the gate during the period between the instants n-1 and n (the Ground Truth)
- wn = w0, w1, …, wN
- yn = y0, y1, …, yN
the number of moving objects counted during the period between the instants n-1 and n by the Virtual Gate algorithm
- Sn = S0, S1, …, SN
counting error in selected time moment
total counting error.
counting threshold (value within range 0, 1…100)
counting threshold correction.
3 Experimental results
The experiments were made in the sports and entertainment hall which maximum capacity is 15.000 of people (“Ergo Arena” located in Gdansk). The image acquisition hardware was deployed at the main entrance which consists of 6 symmetrical doors. The cameras were set to observe only 3 doors because the others were not being used during the events, frequently. The cameras were installed at the height of 6.5 m above the floor, whereas the width of the door is 2.9 m. Image acquisition speed was 30 frames per second, resolution 640 × 360 points.
Total number of 11 recordings have been gathered during sport and entertainment events. Each represents a real situation of people and crowd entering the sports and entertainment hall, whereas the length of each is about 1.5 h. The total length of the experimental material is about 16.5 h. The number of people in each test recording was counted manually and treated as Ground Truth reference value, which was later compared to the Virtual Gate algorithm output.
The people counting system based on Virtual Gate algorithm can count in real time people passing through numerous entrances. The image gathered from multiple camera is being analyzed simultaneously on a supercomputer with the support of the KASKADA platform. Such a centralized architecture provides simplicity of changing the counting system scale.
3.1 Real situations during people counting
The algorithm was examined in real conditions, while crowds have been entering the sport and entertainment hall. Practically some situations posed considerable difficulties for people counting algorithms. Below, we present some examples of people behavior and encountered problems.
3.2 People counting results
Counting threshold (T) parameter of Virtual Gate for test recordings
Recordings 6 and 7 represent cases of the worst achieved counting error values (overestimation and underestimation of number of people, respectively). The error value shown in Fig. 11 is rising rapidly between 33rd and 35th minute of recording. In this period a very dense crowd has pushed towards the hall and groups of people moved chaotically in the area of virtual gate. Moreover, the position of the ticket checker was not constant. In case of chart depicted in Fig. 12, the error is increasing significantly between 35th and 50th minute of the experiment. The error is mainly caused by stopping people in the counting area and by unpredicted movements (i.e. moving back and partially re-entering the counting area).
number of people obtained by Virtual Gate
reference (true) number of people
denotes recording number.
Accuracy of Virtual Gate algorithm
Count (Virtual Gate)
Count (Ground Truth)
Accuracy of V.G. algorithm (A) [%]
The concept and practical application results of the algorithm for people counting in a crowd passing through the gates of large sport object were presented in this paper. We described the approach to the analysis of motion data obtained with the dense optical flow estimated with the devised Virtual Gate algorithm. The algorithm efficiency was examined using some real videos recorded at a large sport and entertainment hall (Ergo-Arena in Gdansk). The counting precision achieved of 97.6 % on an average at total 6,649 persons, is satisfactory considering the real people behavior which was far from the organized movement. A further work will focus on extending the system to operate at other entrances to the hall of the Ergo-Arena object being used less frequently. Moreover, changes of organization of the process of crowd entering the building would be necessary in order to improve the algorithm accuracy. The future work may also focus on a practical application of the system to other large public objects.
Research funded within the project No. POIG.02.03.03-00-008/08, entitled “MAYDAY EURO 2012—the supercomputer platform of context-depended analysis of multimedia data streams for identifying specified objects or safety threads”. The project is subsidized by the European regional development fund and by the Polish State budget.
Open Access This article is distributed under the terms of the Creative Commons Attribution License which permits any use, distribution, and reproduction in any medium, provided the original author(s) and the source are credited.