## 4 Proposed Method
### Moving Object Extraction  
In this step, we extract the foreground moving object out of the enhanced image, based on an existing background subtraction scheme [20]. The background differences method gives a foreground mask in each new frame. However, this approach fails to distinguish between an object and its shadow.  
First, the input video is captured as image sequences. An initial frame, which contains no moving object, is derived as a background reference image. The succeeding frames are compared with this frame to detect the moving object. This is calculated as shown in Equation (2).  
\[S_{n}(x,y)=\left|I_{n}(x,y)-B_{n}(x,y)\right. \tag{2}\]  
where \(S_{n}(x,y)\) is the difference of images, \(I_{n}(x,y)\) is the current frame images, and \(B_{n}(x,y)\) is the adaptive background reference images.  
Most object extraction approaches calculate the difference between a reference frame and a current frame in grayscale images [21]. A major problem with this is that pixels are incorrectly classified, and essential data are lost. Consequently, the expected result is not obtained, effectively leading to a loss of information of the moving object. Therefore, we compute the frame differences in the RGB color space and achieve, to a good extent, the sought-after performance in maintaining the original image details. Eventually, the subtracted color image is converted to a grayscale image and a threshold operator is employed to extract the moving object regions from the image sequences, as described in the next step.  
After completing the frame difference process, the next step applies a low-value thresholding operation. If the thresholds are lowered, regions of the object that have a similar chromaticity to that of the background will be misclassified as shadows, resulting in a high detection rate.  
In the proposed method, the thresholding value is 30.  
\[D_{n}(x,y)=\left\{\begin{array}{c}255,\left(S_{n}(x,y)\right)^{2}>Th\\ 0,otherwise\end{array}\right. \tag{3}\]  
where \(D_{n}(x,y)\) is the new binary mask that is applied to segment out objects of interest and contains a value of \"255\" for each pixel marked as foreground. \(S_{n}(x,y)\) is the difference of images, obtained in the previous section. Additionally, we calculate the square of \(S_{n}\). \(Th\) is a \"predefined\" threshold. We obtained the threshold value based on several experiments. After checking 20 to 60 values, we obtained the expected results for our method when employing the 30 \"threshold\" value. However, in [22], the authors utilized the 40 \"threshold\" value to calculate the overlap regions of the current frame image and its background frame information.  
Image registration, fast moving objects, and large illumination changes may impact the precise segmentation of moving object pixels. Prior to calculating the absolute difference of overlap regions, the average of color differences is computed at the optimal seam, and these values are distributed to the overlap regions to minimize the effect of illumination light source changes. Unwanted edges and noises may come into view on the difference of images when the registration mistake is more than a pixel.