## 3 Proposed System Methodology
### Human Silhouettes Extraction  
After obtaining the preprocessed frames, we performed human/non-human detection by performing multi-level thresholding using Equation (4), as depicted in Figure 3c.  
\[th(x,y)=\left\{\begin{array}{ll}1&\text{if}\ \ \ l(x,y)>t_{1},t_{2},t_{3}\\ 0&\text{otherwise}\end{array}\right. \tag{4}\]  
Figure 2: Preprocessing steps. (**a**) Original color frame of a video, (**b**) histogram of original image, (**c**) histogram of enhanced image, and (**d**) enhanced image.  
where \(th(x,y)\) is the threshold image and \(t_{1},t_{2},t_{3}\) are the applied thresholds that are defined by [PERSON]'s procedure. In order to extract more useful information, the resultant binary image was inverted using a point processing operation that subtracts every pixel of an image from the maximum level of the image, as shown in Equation (5).  
\[C(x,y)=1-th(x,y) \tag{5}\]  
where \(C(x,y)\) is the inverted image, as shown in Figure 3d, and \(th(x,y)\) is the binary image with a maximum level of 1. After obtaining the human/non-human binary foreground frames, we performed morphological operations to remove imperfections in the inverted image \(C\). For the removal of small unwanted objects, erosion was performed, and then, to fill small holes while preserving the size and shape of objects, morphological closing was performed. Every object in image \(C\) was first eroded using erosion as represented in Equation (6) and then dilated using Equation (7), after which the dilated image was eroded again using the disk-shaped structuring element, as shown in Equation (8).  
\[m(x,y)=\left\{\begin{array}{ll}1&\text{if}\qquad S\text{ fits C}\\ 0&\text{otherwise}\end{array}\right. \tag{6}\]  
\[m(x,y)=\left\{\begin{array}{ll}1&\text{if}\qquad S\text{ hits C}\\ 0&\text{otherwise}\end{array}\right. \tag{7}\]  
\[Mo=(C\,\ominus\,S)((C\oplus S)\ominus S) \tag{8}\]  
where \(C\) represents the input inverted image and \(S\) is the disk-shaped structuring element used for erosion and dilation, while \(Mo\) is the resultant image. The erosion of \(C\) by \(S\) is denoted as \((C\ominus S)\); however, the dilation of \(C\) by \(S\) is denoted as \((C\oplus S)\). After morphological operations, all the objects in the image were grouped and labeled, which helped in extracting and uniquely analyzing every object that was required for human silhouette extraction.  
After human/non-human detection, for human silhouette extraction, we calculated the center and extreme points of each of the labeled objects of \(M_{o}\), then we extracted each object one by one, and the distance from center to two extreme points was calculated  
Figure 3: Object detection steps. (**a**) Original color frame of a video, (**b**) enhanced image, (**c**) binary image after multi-level thresholding, and (**d**) inverse of a threshold image.  
for every object for non-human filtering, as shown in Figure 4. The same procedure was adopted for the frames from frame 1 to frame \(Z\).  
After calculating the distances, those objects whose distances were greater than the set threshold were discarded using Equation (9), and only silhouettes resembling humans were retained.  
\[E_{h}=\left\{\begin{array}{ll}0&\text{if }d_{1}>T\cap d_{2}>\text{ T}\\ 1&\text{otherwise}\end{array}\right. \tag{9}\]  
where the distance from the center to one extreme point is denoted by \(d_{1}\), the center to the other extreme point distance is represented by \(d_{2}\), \(T\) is the set threshold and \(E_{h}\) is the resultant image. After human silhouette extraction, most of the non-human objects were discarded by the distance algorithm; however, some non-human objects that resembled human objects remained.