# A Lightweight Visual Odometry Based on LK Optical Flow Tracking
## 2 System Description
### Strategy for Removing Mismatched Points  
By combining the uniform motion model and the pyramid-based LK optical flow method, a robust initial key point matching set can be established between two adjacent images. However, mismatches may still occur. To solve this problem, a combined mismatch point (outer point) elimination algorithm is adopted in this paper to filter out the outer points. The specific process is shown in Figure 5. The main idea is to combine different outlier rejection algorithms to eliminate outer points in turn. This can effectively combine the advantages of different algorithms to improve the speed and accuracy of outlier rejection. For the matching set of initial key points, the GMS algorithm is used to quickly filter out the external points. Then, RANSAC is used for secondary refinement to obtain the optimal matching set, which provides accurate matching points for the pose estimation of the camera. The advantage of this design is that it combines the fast robustness of the GMS algorithm with the accuracy of the RANSAC algorithm. Before using the RANSAC algorithm to eliminate outliers, most of the outliers in the initial matching set have been quickly eliminated via the GMS algorithm, which provides a matching set with fewer outliers for the RANSAC algorithm, so that the RANSAC algorithm can converge to the correct result faster. The core idea of the GMS algorithm is that the correct key point matching should satisfy the motion smoothness constraint, which means there are more matching pairs in the neighborhood of the correct matching point for support, while the wrong matching point does not have this property. As shown in Figure 6, suppose there are \(\{M,N\}\) key points in two adjacent images \(\{I_{a},I_{b}\}\) and the initial key point matching set is \(X=\{x_{1},x_{2},\cdots,x_{i},\cdots x_{N}\}\), where \(x_{i}\) represents the matching pair \(i\), and the neighborhood of this matching pair is defined as \(\{a,b\}\). The neighborhood of the correct matching point is in the yellow circle, and the neighborhood of the false matching point is in the red circle. The support quantity of the matching pair in the neighborhood of the correct matching \(x_{i}\) is \(S_{i}=2\), while the support quantity of the matching pair in the neighborhood of the  
Figure 4: Key point motion vector solution based on the pyramid. Figure 5: Combined mismatch point elimination algorithm. incorrect matching \(x_{j}\) is \(S_{j}=0\). Outliers can be identified and filtered out by the support of matching pairs in the neighborhood. To improve the real-time performance of the algorithm, the GMS algorithm divides the image into \(G\times G\) non-overlapping grids and counts the support of matching pairs within \(K\) neighborhoods of the matching points to calculate the synthesis score \(S_{i}\). The calculation of the neighborhood matching pair can be accelerated by the gridding images, which effectively reduces the complexity of the algorithm. The value \(S_{i}\) can be calculated via the following formula:  
\[S_{i}=\sum_{k=1}^{k=9}|x_{x_{k}p_{k}}|-1 \tag{9}\]  
where \(x_{x_{k}p_{k}}\) is the corresponding matching subset in the neighborhood \(x_{i}\), \(k\) is the number of neighborhood grids. The larger the value of \(S_{i}\) the higher the probability that matching is correct. Since the matching relationships of each key point are independent, \(S_{i}\) can be treated as an approximate binomial distribution. \[S_{i}\sim\left\{ \begin{array}{c}B(kn,p_{t}),x_{i}\text{is a true match}\\ B\left(kn,p_{f}\right),x_{i}\text{is a false match}\end{array} \right. \tag{10}\]  
The mean \(m\) and standard deviation \(s\) of a binomial distribution \(S_{i}\) can be expressed via the following equation:  
\[\left\{ \begin{array}{c}m_{t}=Knp_{t},s_{t}=\sqrt{Knt(1-pt)},x_{i}\text{is a true match}\\ m_{f}=Knp_{t},s_{f}=\sqrt{Knt(1-pt)},x_{i}\text{is a false match}\end{array} \right.