## 2 System Architecture
### Drone Visual Image Tracing Method  
The drone image visual tracing process identifies a drone in motion using images acquired by a thermal imaging camera or full-color camera. These cameras inside a dual-axis mechanism were adopted for image acquisition in this study. After image acquired, vision image processing is performed and then drone tracing is done through motor control of the above platform. A dual-axis tracing device adopts image processing techniques to deal with images of a dynamic object. An image capture card in the device acquires pictures at a speed of 30 frames per second, and then performs image processing, as shown in the image processing flowchart in Figure 2. The acquisition of a dynamic drone contour [15; 16] is carried out by the frame difference method with image pre-processing. Figure 1: Design of the dual-axis mechanism. First, the original image, as shown in Figure 3a, is converted to grayscale of S\({}_{\text{gray}}\) by RGB conversion [15] as shown in Figure 3b. The formula is:  
\[S_{gray}=0.299R+0.587G+0.114B \tag{1}\]  
where RGB is the three primary color pixel values of the original image. The grayscale image of Gaussian filter and median filter is then used to remove noise and smooth the image to avoid misjudging subsequent images due to noise effect as shown in Figure 3c. Processing Figure 3c as a histogram can obtain a histogram of the image. The histogram of the image can be found that there is a highest value in the histogram. Its value is the T value. After threshold processing, a binary image can be obtained as shown in Figure 3d. After threshold processing is performed, the method of dilation in morphology can be used to segment independent image element of the UAV so that the UAV is highlighted in the picture for better tracking of the system. The dilation operation is shown in Equation (2), where A is the original image and B is the mask. The core operation is that there is an object at the neighboring point and the position is set as an object. \[A\oplus B=\{z|\left(\hat{\beta}\right)_{z}\cap A\
eq 0\} \tag{2}\]  
Figure 3e shows the image after dilation (morphology), which fills the gap in the broken UAV image. The frame difference method allows extraction of a motion region [17; 18] on two adjacent images by performing differential operations. It oversees the movement of anomalous objects [19] in the picture with the movement of the target and the movement of the camera. There will be a significant difference between adjacent frames. For real-time tracing, due to the fast drone flight speed, a small amount of immediate calculation is needed to trace the drone steadily. There is an advantage that the background accumulation problem for the frame difference method is almost ignored. The renew speed is quick, and less calculation is required for tracing a drone immediately, which is shown in Figure 3f. The equation is as follows:  
\[D(x,y)=f_{m+1}(x,y)-f_{m}(x,y) \tag{3}\]  
Figure 2: Drone image tracing flowchart. where \(D(x,y)\) is the result of differential operation for the \(m^{\text{th}}\) frame and \((m+1)^{\text{th}}\) frame. The drone tracing mechanism of a dual-axis tracing device is to convert a two-dimensional variation of the pixels of a captured image (\(\Delta\)x, \(\Delta\)y) into a step-level control amount of a two-axis step motor inside the above device. A movement amount is calculated by the above conversion of acquired images, which is applied to complete drone tracing operations. Suppose the image's resolution is set as 2P \(\times\) 2Q pixels, which is shown in Figure 4. An acquired screen image's origin point is set as \((x_{0},y_{0})\), and its pixel coordinate is (-P, -Q). The screen's center point is \((x_{1},y_{1})\), which is the concentric point in the tracing screen, and its pixel coordinate is defined as (0, 0). Therefore, the pixel of the screen image in the \(x\)-axis ranges from -P\(\sim\)+P, and the \(y\)-axis ranges from -Q\(\sim\)+Q.