## 2 Materials and Methods
### Moving Object Detection Based on Robust Feature Threshold Segmentation  
Estimating the optical flow between successive frames can determine the optical flow vector field and compute the motion vector of each point. However, the position and state of the moving target in the image cannot be detected. The optical flow vector must be further processed to determine the specific moving target area. Hence, a moving object detection method based on the threshold segmentation of Harris robust background feature points was suggested to detect and segment moving object foreground regions in the stationary and moving backgrounds. First, the Harris feature points in the current frame are extracted. Their positions in the next frame are calculated according to their corresponding optical flow values. Then, based on the principle that the image background conforms to the graphical affine transformation, the Harris feature points and their corresponding positions are combined in the next image. According to the M-estimators Sample Consensus (MSAC) algorithm [33], the feature points that do not belong to the background model and their optical flow values are excluded from solving the affine transformation homography matrix on the image background model. Robust Harris feature points are known as the Harris feature points of the background region. The robust feature points' optical flow value is used as the threshold to segment the foreground region of the moving object; hence, the binary image of the foreground of the moving target is obtained. Finally, morphological image processing is used to deal with the issues of pores, discontinuities, and irregular moving edges in the binary image and create the foreground mask of the moving target regions. (1) Image optical flow vector field normalization processing  
Because the estimated optical flow vector field cannot be directly thresholded, it is necessary to normalize the optical flow vector field to transform the optical flow vector field of the image into a grey value image based on the optical flow. First, the Euclidean norm of the optical flow vector value \(\overset{\rightarrow}{\omega}(\mathrm{x},\mathrm{y})=[uv]\) at each pixel point is calculated and used as the optical flow grey value \(V(x,y)\) at this point. The calculation formula is expressed as follows:  
\[V(x,y)=\sqrt{u(x,y)^{2}+v(x,y)^{2}} \tag{9}\]  
Next, the obtained image optical flow grey value \(V(x,y)\) is normalized to determine the normalized grey image \(V_{norm}\):  
\[V_{norm}(x,y)=\frac{V(x,y)-V_{min}}{V_{max}-V_{min}} \tag{10}\]  
s.t. \(V_{max}=\max(\sqrt{u(x,y)^{2}+v(x,y)^{2}})\); \(V_{min}=\min(\sqrt{u(x,y)^{2}+v(x,y)^{2}})\)  
(2) Optical flow thresholding processing based on Harris robust feature points  
This study found that the feature points in the common scene are fixed no matter whether the camera is moving or stationary. Furthermore, due to the background movement caused by the camera movement, the position change of the feature points in the background area of the front and back frames conforms to the image affine transformation, whereas the relative position of the feature points in the moving object area changes in the front and back frames, which does not conform to the affine transformation. Therefore, an affine transformation matrix was built to solve the background model between the adjacent frames. Because the optical flow estimate of the image pixel depicts a certain error, the optical flow estimate of the pixel point has a higher estimation accuracy at the image brightness change area and the image gradient change area. Moreover, the affine transformation matrix [25] calculation does not require the global pixel points and their optical flow values. Therefore, the feature points and their optical flow value were extracted. Next, thehomography matrix \(M\) of the affine transformation of the background region model was calculated according to the feature points and their optical flows.