## 3 Proposed System Methodology
### Crowd Behavior Detection
#### 3.4.1 Global-Local Descriptors  
For the global-local descriptor, we used a fusion of global and local image properties. In global features, we described the visual content of the whole image and we had the ability to represent an image with a single vector. Here, we extracted the crowd contour as a global feature. For local features, we used our newly proposed particles gradient motion features, geometric features, and speeded up robust feature (SURF) [104]. For local features, we extracted interest points and represented them as a set of vectors that respond more vigorously to clutter and occlusions. Initially, in global features, we found the center of each human and considered all the humans in the scene as a vertex; this can be denoted as \(P=\left[P1,\,P2,\,\ldots\,,\,Pn\,|\,Pi=(Xi,\,Yi)\right]\), where \(P\) represents the whole human crowd in the scene, considered as a set of vertices, and \((Xi,\,Yi)\) are the coordinates of the \(i\)th human. We considered only those humans that were at the extreme points and joined them with a line, forming the biggest graph, covering all extreme vertices, as shown in Figure 12. The graph represented the human crowd contour, and thus, the variations in the shape of a graph three a flash on variations in the outer area of the human crowd, i.e., on global changes. To measure the variations in the crowd contour, we compared the contour temporally by integrating over all of the pixels of the contour. In general, we defined the \((p,\,q)\) moment of a contour as in Equation (14):  
\[m_{p,q}=\sum_{x}^{n}\sum_{y}^{n}I(x,y)x^{p}y^{q} \tag{14}\]  
where \(I(x,y)\) is the intensity of the pixels in coordinate \((x,y)\). Here, \(p\) is the \(x\)-order and \(q\) is the \(y\)-order, whereby, order means the power to which the corresponding component is taken in the sum just displayed. The summation is over all of the pixels of the contour boundary (denoted by \(n\) in the equation). It then follows immediately that, if \(p\) and \(q\) are both equal to \(0\), then the \(m_{0,0}\) moment is actually just the length in pixels of the contour. The moment computation just described gives some rudimentary characteristics of a contour that can be used to compare two contours. Figure 12: Extraction of human crowd contour as a global feature. In the SURF descriptor [105], we computed distinctive invariant local features, which detected the interest points and elaborate features that depict some invariance to image noise, rotation, direction, scaling, and changes in illumination. Using SURF, we computed 75 local points for every human silhouette in an image, and thus, for every frame, we had 1050 SURF descriptors in a set of vectors, as shown in Figure 13:  
In geometric local features, we first identified the skeleton joints of every human silhouette in each frame using a skeleton model, and then, by considering skeleton joints as vertices, we drew poly-shapes and triangles with three or four vertices. By using the left arm, neck, left shoulder, and torso, a left polygon wing was drawn and filled with a color. Similarly, a right polygon wing was drawn and filled with different colors using the right arm, neck, torso, and right shoulder. Additionally, the torso area, lower area, left shoulder triangles, and right shoulder triangles were drawn, as depicted in Figure 14. The areas enclosed under these polygons were analyzed frame by frame, and on the basis of angle differences and area size, normal and abnormal behaviors of human crowds were detected. Algorithm 1 depicts the overall procedure used for the extraction of the strongest body points for human silhouettes. In particles gradient motion (PGM), we first converted every human silhouette into particles and then only those particles that were on the human contour were considered, and their interaction force was calculated. Generally, every pedestrian in a crowd has a desired direction and velocity \(v_{i}^{d}\), calculated using Equation (16).