## Materials and Methods
### Harbor Candidate Extraction
#### 2.2.1 SIFT Keypoints Extraction Method Based on Edge Categories  
The traditional SIFT algorithm takes the extreme points searched in the entire scale space as keypoints, and it will generate a lot of redundant keypoints. Therefore, we propose a keypoint location strategy instead of searching extreme points in the entire scale space. First, we use the geometric invariant moment to extract the EC of images, and then we search for the extreme points corresponding to the EC in the scale space. The flow of the EC-SIFT algorithm is shown in Figure 11.  
The EC is defined as a collection of regions containing image edge information, so we look for EC in the image sub-block, and we split the images into image sub-blocks of the same size. In order to make the moment of image sub-blocks have the characteristics of translation, rotation and scale invariance, we use a moment invariant of the Hu moment [10]. It is defined as follows:  
\[\Phi(x,y)=\eta_{20}+\eta_{02} \tag{4}\]  
where \(x\), \(y\) are the subscripts of the image sub-blocks. \(\eta_{pq}\) represents the normalized center moment; the formula is as follows:  
\[\eta_{pq}=\frac{u_{pq}}{u_{00}^{r}}\times(r=\frac{q+p}{2}) \tag{5}\]  
where \(u_{pq}\) is the central moment, it is defined as follows:  
Figure 3: Flow chart for a scale-invariant feature transform keypoints extraction method based on edge categories (EC-SIFT) algorithm. \[u_{pq}=\sum_{x=1}^{C}\sum_{y=1}^{R}(x-x_{0})^{p}\times(y-y_{0})^{q}\times f(x,y) \tag{6}\]  
\(x_{0}\), \(y_{0}\) is the centroid coordinate of the image sub-block region. It is defined as follows:  
\[x_{0}=\frac{m_{10}}{m_{00}},\,y_{0}=\frac{m_{01}}{m_{00}} \tag{7}\]  
\(m_{pq}\) is the origin moment, and it is defined as follows:  
\[m_{pq}=\sum_{x=1}^{C}\sum_{y=1}^{R}x^{p}\times y^{q}\times f(x,y) \tag{8}\]  
The idea of EC extraction is to use image sub-blocks corresponding to local invariant moments whose adjacent moments value jump larger as EC of the images. Therefore, we need to use the moments of adjacent image sub-blocks to calculate the gradient values for the moments of each image sub-block. After the gradient is taken, we set a jump threshold \(T\), and the gradient value of the image sub-block smaller than the threshold \(T\) is zeroed; other image sub-blocks are adjusted as EC of the images. The gradient calculation formula of the image sub-block is defined as follows:  
\[F(x,y)=\left\{ \begin{array}{c}G(x,y)=|\Phi(x,y)-\Phi(x+1,y)|+|\Phi(x,y)-\Phi (x,y+1)|,\quad G(x,y)\geq T\\ 0,others\end{array} \right. \tag{9}\]  
The local brightness values of the entire image may not be an order of magnitude; thus, if a fixed threshold \(T\) is used for all gradient values, a part of the edge regions will be missed when \(T\) is too large, and false edge regions will appear when \(T\) is too small. We can solve this problem with adaptive threshold \(T\), which is defined as follows:  
\[T=0.15\times\Phi(x,y) \tag{10}\]  
The above formula determines the threshold \(T\) based on the local luminance information, which can distinguish the brightness jumps of different orders of magnitude. When we segment the image, the image sub-blocks of the edge regions do not all cross the edge line of the image; many image sub-blocks are offset, and some of them even use the image edge lines as the boundary of the image sub-block. If such sub-block is used as the EC region of the image, we will lose a lot of edge information. Therefore, we need to make adjustment to the reserved image sub-blocks, so that the image sub-blocks cross the edge lines as much as possible; in this way, we can ensure that EC contains most of the edge information.