# An Improved Visual SLAM Based on Map Point Reliability under Dynamic Environments
## 2 Proposed Method
### Unreliable Map Points Processing Strategy  
The algorithm in this section mainly deals with map points left in SLAM by landmarks that are not moving fast enough. As we know, the traditional V-SLAM uses the PnP (perspective-n-point) method to calculate the pose of a frame, which is as follows:  
\[p=\Phi\cdot T\cdot P \tag{3}\]  
where the \(p\) is the feature point extracted from the current frame and is a projection of a landmark in the real world, \(\Phi\) is the camera calibration and distortion parameters, \(P\) is a map point of the same landmark which is generated in the previous frame, and \(T\) is the pose of the current frame. In a static environment, \(P\) can always be treated as a landmark. However, when it comes to dynamic environments, \(P\) can only represent the map point of the landmark at the previous time. Although \(p\) and \(P\) can be matched through the description, this matched pair cannot be used for pose calculation.  
Figure 3: The difference of the generated map between ORB-SLAM3 and our SLAM: (**a**) the result of ORB-SLAM3; (**b**) the result of our method. There are some dynamic map points left after dynamic objects are gone in Figure 2(a). Compared with ORB-SLAM3, the results in Figure 2(b) indicate that our algorithm can deal with these map points effectively.  
```
0:\(P\): New map points in current frame; \(\mathcal{M}\): A set of all map points in the active map;
1:for each \(p\in P\)do
2: %Compute the node serial number (denoted by \(NodeId\)) of \(P\);
3:\(p.NodeId=f_{DBbW2}(p)\);
4: %\(f_{DBbW2}\) is the algorithm of DBoW2;
5:\(\mathcal{S}=\mathcal{M}(p.NodeId)\);
6: %Get the map points set in \(\mathcal{M}\) at the same \(NodeId\) as \(p\);
7:for each \(s\in\mathcal{S}\)do
8:if\(sim(p.d,s.d)\leqslant 0.5\)then
9: %\(sim(\cdot)\) is the score function; \(p.d\) is the description of the current map point; \(p\);
10:if\(s.isBad==1\)then
11: %\(s.isBad\) is the flag to denote whether \(s\) has been checked before;
12: Break;
13:else
14: \(s.isBad=1\);
15:endif
16:endif
17:endfor
18:endfor
19:for each \(p\in P\)do
20: \(\mathcal{S}=\mathcal{M}(p.NodeId)\);
21: \(\mathcal{S}.insert(p)\);
22: %Insert \(p\) into the end of \(\mathcal{S}\);
23:endfor
```  
**Algorithm 1** Repeated map points elimination operation  
To deal with this problem, we propose an unreliable map points processing strategy (called UMPP). As we know, in feature-based visual SLAM, matching pairs of map points and projection points are used to calculate the pose of the camera in each frame. There are correct matches and mismatches in these matching pairs, but not all matching pairs in the current frame are needed. The proposed UMPP strategy can be described as follows:  
\[p =\Phi\cdot T\cdot P^{r} \tag{4}\] \[P^{r} =\text{UMPP}(T,P^{u}) \tag{5}\]  
where \(P^{r}\) is the reliable part of map points, and \(P^{u}\) is the unreliable part of map points. As shown in Figure 4, the idea of the proposed UMPP strategy is that we can calculate the pose of the camera with reliable map points (regardless of whether they are mismatches) and then calculate the reprojection of the rest of the map points with unknown reliability at this pose.  
In the proposed V-SLAM method, we set the map points which have not been checked three times as unreliable map points (called U-MPs). If the error between the reprojection coordinate and the corresponding feature point coordinate is within the threshold range, the current unknown reliability point is considered to pass the check at this time. Otherwise, the current map point is considered a dynamic map point (called D-MP), which needs to be eliminated from the current frame. Finally, the U-MPs whose reliability exceeds the threshold are set as the reliable map points (called R-MPs).  
It is noted that within an early period of time when SLAM is running, we cannot find any reliable map points, so the map points matched by these frames can be set as R-MPs only by passing the test described in Section 2.2.