# Brain-Like Navigation Scheme based on MEMS-INS and Place Recognition
## 3 Algorithm
### The Proposed SI-GMS algorithm  
The above two algorithms have some disadvantages when applied to the actual scene matching independently. Therefore, a combination image matching algorithm based on SI and GMS is proposed, the advantages of SI on fast matching and GMS on accurate matching are all possessed.  
**Step 1:** SI algorithm is used to calculate the similarity \(\beta^{\prime}\) of the reference image \(R\) and template image \(T_{i}\), where \(T_{i}\in\mathbf{T}\), T is the set of all template images, and \(T_{i}\) is the \(i\)-\(th\) template. The threshold value \(h\) can be slightly adjusted to avoid omissions in judgment. If \(\beta^{\prime}<h\), the two images are considered relatively similar, then go to the next step; otherwise, read the next frame of the reference image.  
**Step 2:** the longitude and latitude coordinates calculated by INS are read to calculate the distance to the location of the template image successfully matched:  
\[D=\sqrt{\left[\frac{T_{i}(x)-I_{t}(x)}{180}\times\pi R\right]^{2}+\left[\frac{T _{i}(y)-I_{t}(y)}{180}\times\pi R\right]^{2}}, \tag{18}\]  
where \(\{T_{i}(x),T_{i}(y)\}\) represents the latitude and longitude coordinates of template \(T_{i}\), \(\{I_{t}(x),I_{t}(y)\}\) represents the coordinate value returned by INS at time \(t\), \(R\) is the radius of the earth.  
When \(D\leq\sigma\), the data is considered valid and the next step is executed, where \(\sigma\) is the maximum reasonable distance between the position obtained by INS and place matching.  
**Step 3:** the matching results that satisfy the distance constraint are checked by GMS algorithm. If the number of successful matching points \(N\) between the two images is greater than the threshold value \(\Omega\), it is considered as a correct set of matching points; otherwise, it is omitted.  
\[U=\begin{cases}True&N\geq\Omega\\ False&N<\Omega\end{cases}, \tag{19}\]  
where \(U\) represents the matching result.  
The completion of the above three steps helps the system meet the real-time matching requirements and effectively eliminates some matching points of misjudgment. The proposed SI-GMS algorithm is shown as follows:  
```
1:Calculate the scanline intensity of two images.
2:Find the minimum difference \(\beta^{\prime}\) of the intensity distribution using Equation (12)
3:If \(\beta^{\prime}<h\)then
4: Read the latitude and longitude information returned by INS
5: Calculate the distance \(D\) between the coordinates of the template and the coordinates returned from INS using Equation (18)
6:If \(D<\sigma\)then
7: Detect the feature points of the two images
8: Match the feature points
9: Use GMS to eliminate erroneous matching points
10: Counting the number of remaining points \(N\)
11:If \(N>\Omega\)
12: Output the latitude and longitude coordinates of the current face template image
13:Return \(True\)
14:End if
15:End if
16:End if
17:Return False
```  
**Algorithm 2**SI-GMS algorithm  
We used some groups of images from KITTI, which is a publicly available standard dataset, to test the proposed SI-GMS algorithm. As shown in Figure 8:  
The similarity values \(\beta^{\prime}\) of these two groups of images are calculated as 0.051 and 0.039 respectively. In addition, the number of the successfully matching points after using the GSM algorithm are 114 and 178 respectively. As shown in Figure 9: