## 4 Aircraft Tracking and Activity Recognition
### NCC-Based Template Matching for Aircraft Tracking  
The normalized correlation coefficient (NCC) [29] based image matching method was used to achieve aircraft tracking. The template matching algorithm consists of two steps. First, both the aircraft template image and the image of the search area were normalized according to the following equations. \[T^{\prime}(x,y)=\frac{T(x,y)-\frac{1}{w_{T}\times h_{T}}\left(\sum\limits_{0 \leq x\leq w_{T},0\leq y\leq h_{T}}T(x,y)\right)}{\sqrt{\sum\limits_{0\leq x \leq w_{T},0\leq y\leq h_{T}}T(x,y)^{2}}} \tag{1}\]  
Figure 6: Determining the initial aircraft template image from the rotation detection results in the start frame. \[S^{\prime}(x,y)=\frac{S(x,y)-\frac{1}{w_{S}\times h_{S}}\left(\sum\limits_{0\leq x \leq w_{S},0\leq y\leq h_{S}}S(x,y)\right)}{\sqrt{\sum\limits_{0\leq x\leq w_{S},0 \leq y\leq h_{S}}S(x,y)^{2}}} \tag{2}\]  
Here, \(T(x,y)\) and \(S(x,y)\) are the pixel values in the aircraft template image and search area image, respectively. \(T^{\prime}(x,y)\) and \(S^{\prime}(x,y)\) are the pixel values in the normalized aircraft template image and search area image, respectively. \(w_{T},h_{T}\) are the width and height of the aircraft template image, and \(w_{S},h_{S}\) are the width and height of the search area image. The normalized correlation coefficients of these two normalized images were then calculated. Figure 7: Algorithm for aircraft tracking and activity recognition. \[R(x_{0},y_{0})=\sum_{0\leq t\leq\omega_{T},0\leq y\leq h_{T}}\left(T^{\prime}(\hat{ x},\hat{y})*S^{\prime}(x_{0}+\hat{x},y_{0}+\hat{y})\right) \tag{3}\]  
Here, \((\hat{x},\hat{y})\) are the coordinates in the normalized aircraft template image, \((x_{0},y_{0})\) are the coordinates of the upper left corner of the square matching area in the normalized search area image, and \(R(x_{0},y_{0})\) is the value of the normalized correlation coefficient (NCC). The closer the value \(R(x_{0},y_{0})\) is to one, the more similar the template image and the image in the matching area of the search area image are. On this basis, an aircraft tracking algorithm based on neighborhood search and matching was proposed. Figure 8 shows the main flow of each tracking procedure, which consists of four steps. Step 1: To track aircraft in an airport, the matching algorithm needs to be able to adapt to the matching of aircraft in translational and rotational motions. Thus, the search area image was first rotated with a certain step size (2\({}^{\circ}\)) within a certain angle range (\(-10^{\circ}\)\(\sim\)10\({}^{\circ}\)) to obtain a batch of search area images. Then, NCC-based matching was performed between the aircraft template image T and all obtained search area images. We chose to rotate the search area image instead of rotating the aircraft template image, because rotating the template image generates invalid data at its edges, which seriously affects the matching result. Step 2: The best match is identified as the matching result with the largest normalized cross-correlation coefficient. The coordinates at the center point of the best matching area in the search area image (the green center point) are identified according to the matching result. Step 3: The search area image that contains the best match is transformed back to its original (non-rotated) state. Then, the coordinates at the center of the best matching area  
Figure 8: Tracking procedure for matching aircraft in rotated search area images. can be obtained, represented in the coordinate system of the original search area image (the red center point). Finally, the center point and the size of the aircraft template image are combined, and the matching result can be located in the original search area image (the red rectangle). Step 4: The position of the matching result (the red rectangle) in the current input image is calculated; this is the tracking result of the aircraft in the current frame. According to the current tracking result, the search area for the next tracking procedure (yellow dotted rectangle) can be calculated.