## 3 Methodology
### Satellite Image Preprocessing
#### 3.2.2 Filter Keypoints with the Flight Plan  
Using a satellite image to reduce the accumulative error can be time-consuming. To avoid this, we apply a keypoint filter based on the flight plan. First, we calculate the keypoints from a high-resolution image. Although this process is very time-consuming, it is performed offline before the aircraft departs.  
In contrast with the previous stage, where we used ORB, we are now implementing AKAZE [48] for feature extraction, which is an accelerated version of KAZE [47]. The reason for this choice is that AKAZE exhibits one of the best rotation invariances in contrast with other descriptors [45]. This is important because the photographs captured by the UAV may have orientations that differ significantly from those of the satellite image. The result of implementing AKAZE is shown in Figure 10.  
The cardinality of the keypoints in Figure 10b is 68,061; this will imply a huge consumption of resources. To mitigate this, we filter these keypoints by using the flight plan that we show in Figure 11a. In this case, the user provides a path instead of calculating it.  
We calculate the angular distance \(d_{\alpha}\) of each keypoint in the satellite image to the interpolated flight plan path with (9), where \((lat_{kp},lon_{kp})\) represents the keypoint position on the map and \((lat_{path},lon_{path})\) is the closest point to the keypoint in the flight plan path.  
\[d_{\alpha}=\sqrt{(lat_{path}-lat_{kp})^{2}+(lon_{path}-lon_{kp})^{2}} \tag{9}\]  
In Figure 12a, we construct the histogram of the angular distance for all the keypoints of the satellite image. This histogram is important because it gives us an idea of the keypoint distribution. The keypoints closer to the path are more likely to be good reset points.  
To preserve the points closer to the path, let us set a threshold of 0.005 over the distance to the path; we can obtain the filter keypoints (Figure 11b). In this case, we count 25,256 keypoints, which is still a huge dataset to operate in real time. Notice that the  
Figure 11: Satellite image keypoints filtered based on their proximity to the flight plan defined by the user and represented with the red line in (**a**).  
Figure 10: Demonstration of the number of keypoints present in the satellite image. In the flight plan area, 68,061 keypoints have been identified, which are shown in (**b**).  
resulting map is dense, expensive in memory, and does not allow us to use points far from the path to correct the error. For this reason, using a threshold on the distance does not work for this application.  
To have a better filter over the keypoints, we fit an exponential probability model, shown in (10), to the histogram of the angular distance by using the maximum likelihood estimation (MLE) algorithm. In Figure 11(b), we show the fitted exponential function.  
\[f(x)=\lambda e^{\lambda x} \tag{10}\]  
We use the fitted exponential function to randomly sample keypoints (without replacement), where the keypoints closer to the flight plan are more likely to be sampled. This process has the advantage of allowing us to specify the number of filtered keypoints, thereby controlling the time required for correction.  
In Figure 12(a), we illustrate a simulation of the probability distribution over the map. Notice that the probability of using a particular site depends on this probability function and the quantity of keypoints. In Figure 12(b), we present the final filtered keypoints, limited to 5000 (we have chosen this number of keypoints so that the onboard computer can process them in real time). We find that this number of keypoints allows us to achieve real-time application.