## 3 Proposed System Methodology
### Crowd Behavior Detection
#### 3.4.1 Global-Local Descriptors
However, in crowded scenes, because of the presence of multiple persons, individual movements are limited, and the actual velocity of each pedestrian \(v_{i}\) is different from their respective expected motion. The actual velocity of particles is calculated using Equation (15). \[v_{i}=F_{agg}(x_{i},\ y_{i}) \tag{15}\]  
Figure 14: (**a**) Geometric features for all human silhouettes. (**b**) Magnified view of geometric features for two human silhouettes. Figure 13: (**a**) SURF features for all human silhouettes and (**b**) magnified view of SURF features for two human silhouettes. where \(F_{avg}(x_{i},\,y_{i})\) is the \(i\)th particle average optical flow in the coordinate \((x_{i},\,y_{i})\). We calculated the desired velocity \(v_{i}^{\,d}\) of particles as:  
\[v_{i}^{\,d}=(1-w_{i})\ F(x_{i},\ y_{i})+\ w_{i}F_{avg}(x_{i},\ y_{i}) \tag{16}\]  
where \(F(x_{i},\ y_{i})\) represents \(i\)th particle optical flow with coordinates \((x_{i},\ y_{i})\) and \(w_{i}\) is the panic weight parameter. The pedestrian \(i\) displays vanity behaviors as \(w_{i}\to 0\) and collective behaviors as \(w_{i}\to 1\). Linear interpolation was used for the enumeration of efficient optical flow and the adequate average flow field of particles. Thus, on the basis of the actual velocity and the desired velocity, we can calculate the interaction force using Equation (17):  
\[F_{\text{int}}=\frac{1}{T}\left(v_{i}^{\,d}-v_{i}\right)-\frac{dv_{i}}{dt} \tag{17}\]  
where \(F_{\text{int}}\) is the resultant interaction force, as represented in Figure 15 and \(T\) is the relaxation parameter. When the interaction force of particles was greater than the set threshold, it was detected as an abnormal event; otherwise, it was considered to be normal. ``` Input: E: Extracted Human Silhouettes Output: Strongest body points, i.e., head, shoulders, legs, arms, hips /* for each connected component, extract body points. B = bwboundaries(binary_image);  lbl = bwlabel(binary_image);  CC2 = bwconncomp(lbl);  L52 = labelmatrix(CC2);  for objectidx2 = 1:CC2.NumObjects  individuals1 heouts2 = bsxfun@times, closezn, L52 == objectidx2); [labeledImage2,numberofBlobs2] = bwlabel(individualsilheouts2,4);  end Aa = individualsilheouts2; /* Defining a upper, middle and lower portion for each individual silheouts */ th = hershold;  rps = regionprops(Aa,'Boundingbox,'Area');  for k = 1 to length(rps) do  w = rps(k). Boundingbox  if height > th and width > th then  upper_region = struct('x,w(1),'y, w(2),'width',w(3), 'height', w(4)/5); /* head */  middle_region = struct('x',w(1),'y', w(2) + w(4)/4, 'width',w(3), 'height', w(4)/4); /* arms */  lower_region = struct('x',w(1),'y', w(2) + w(4)/2, 'width',w(3), 'height', w(4)/2); /* legs */  j = j + 1;  s(j) = w;  end  end  top = [x,max_y]:left = [min_x,y]:bottom = [x,min_y]:right = [max_x,y]; % label the head region%  head =top pixels of upper region  Right Shoulder = Bottom right pixels of upper region  Left Shoulder = Bottom left pixels of upper region  Right arm = Right Pixels of middle region  Left arm = Left Pixels of middle region  Right foot = Bottom right pixels of lower region  Left foot = Bottom left pixels of lower region  return Head, Shoulders, arms, foot

#### 3.4.2 Event Optimization: Bat Optimization

Optimization is a process by which the optimal solutions of a problem that satisfies and objective function are accessed [106; 107; 108; 109]. [PERSON], in [110], introduced an optimization algorithm inspired by a property of bats, known as echolocation. Echolocation is a type of sonar that enables bats to fly and hunt in the dark. The bat optimization (BO) algorithm is composed of multiple variables of a given problem. Using the echolocation capability, bats can detect obstacles in the way and the distance, orientation, type, size, and even the speed of their prey. BO has multiple agents depicting the parameters of the layout dilemma, as any other metaheuristic mechanism.