# An Improved Visual SLAM Method with Adaptive Feature Extraction
## 3 Our Method
### Improved Feature Extraction Algorithm
#### 3.1.6 Divide Feature Points with Quad-Tree  
Similar to [10], we additionally partition the feature points using the quad-tree approach to ensure that they are distributed equally. We initialize the nodes of each layer of the pyramid image, divide the image into four regions, and obtain four sub-nodes. We count how many feature points are present in each node. If a node does not include any feature points, it should be deleted; if it has just one, it ought to be marked as a leaf node, saved, and no longer split; if the node contains multiple feature points, it is called the parent node and continues to be divided. If all the current nodes are non-repartitionable or the sum of the number of leaf nodes and the number of parent nodes that need to continue to be partitioned reaches the requirement of the number of feature points, the partition is terminated. We retain the feature points in each node area with the largest response value. The division outcome for a target of 20 feature points is depicted in Figure 3, where the red dot is the feature point and the area of the fork is the deleted node area.  
Figure 2: Principle of the adaptive and generic accelerated segment test. The nodes indicate the pixels in the current feature extraction region, and the shade of the leaf node color indicates the difference between the pixel point and the center point. The lighter color indicates that the two pixel points are more similar in gray value, and the darker color indicates that the two pixel points are more different in gray value. Reproduced with permission from [20], Spinger Nature, 2010.  
3.1.7. Intensity Centroid Method to Calculate the Orientation of Feature Points  
According to the method proposed by [27], we define the direction of the feature point as the angle between the line connecting the feature point to the centroid of the picture block centering on the feature point and the horizontal direction. Shown in Figure 4a is an example of an image block. The centroid calculation formula for the image block is as follows:  
\[Q=\left(\frac{m_{10}}{m_{00}},\frac{m_{01}}{m_{00}}\right), \tag{7}\]  
where \(m\) stands for the moment of the region, which is calculated as follows:  
\[\begin{split} m_{10}=\sum_{x,y}xI(x,y),\\ m_{01}=\sum_{x,y}yI(x,y),\\ m_{00}=\sum_{x,y}I(x,y).\end{split} \tag{8}\]  
This allows us to determine the feature points' orientation as follows:  
\[\theta=arctan(\frac{m_{01}}{m_{10}}) \tag{9}\]  
The orientation of the feature points provides rotational invariance for the feature points. It is illustrated in Figure 4c as the image of Figure 4b after rotation, and the orientation of the feature point P remains unchanged during the rotation.  
Figure 4: Rotation invariance correlation. (**a**) is an example of determining the direction of feature points. (**c**) is the rotation of (**b**) the direction of the feature point does not change. Where P is the feature point. Q is the centroid of the point P.  
Figure 3: An example of the quad-tree algorithm dividing feature points, where the red dot is the feature point and the area of the fork is the deleted node area.