# Precise Feature Removal Method Based on Semantic and Geometric Dual Masks in Dynamic SLAM
## 3 Methodology
### Dual-Mask Method for Dynamic Feature Point Filtering  
Under the assumption of a constant velocity model in monocular visual SLAM, the proposed system typically uses the pose from the previous frame as the initial value for the current frame's initial pose, matching it with the 3D map points corresponding to feature points from the previous frame. To achieve feature matching, feature points associated with known map points from the previous frame are reprojected into the current frame and matches are sought based on their descriptor information. However, points determined as geometric outliers in the previous frame often have large reprojection errors, possibly due to inaccurate localization, descriptor anomalies, or being located on the surface of dynamic objects. Consequently, traditional ORB-SLAM systems usually adopt the strategy of excluding feature points marked as outliers from the previous frame, preventing them from participating in the current frame's feature matching process. This avoids wasting computational resources and reduces potential mismatches. To enhance the system's ability to discriminate dynamic areas, this paper proposes a dual-mask dynamic feature filtering method that integrates semantic priors with geometric consistency verification. This approach re-utilizes feature points identified as outliers in the previous frame as clues for potential dynamic regions, combining them with instance masks provided by semantic segmentation to spatially constrain dynamic objects. When the number of outliers detected in the current frame falling within the semantic dynamic mask region exceeds a set threshold, these points are considered to be dynamic features. In this way, the system realizes dynamic detection driven by both semantic and geometric cues. This method not only combines information about dynamic physical objects from a semantic perspective, it also relies on geometric verification to identify unstable regions, effectively avoiding the influence of both pure semantic misjudgments (such as stationary pedestrians or parked vehicles) and pure geometric misjudgments (such as outlier points caused by sparse features). For local dynamic targets, for instance a person moving only their head or hand, it would be inappropriate to label the entire body region as dynamic; to address this, the system initially identifies feature points that have been verified as outliers in the current frame and marks those that fall within the semantic dynamic mask as dynamic features. Subsequently, these outlier points undergo morphological dilation (approximately 60 pixels) to expand their influence area, creating a local dynamic point mask. Finally, this dilated mask is intersected with the semantic mask. This limits the dynamic region to only cover portions of potential dynamic objects, thereby obtaining a more precise final dynamic mask. The processing flow is depicted in Figure 2. The input consists of two consecutive frames, from which the system first obtains semantic masks through semantic segmentation; then, combining geometric consistency checks, it identifies dynamic outliers to generate an outlier mask. Finally, the semantic mask and the outlier mask are combined to produce an accurate dynamic object mask, achieving more precise dynamic feature point removal. The final mask generation process can be expressed by the following mathematical equation:  
\[M_{\text{final}}=M_{\text{obj}}\cap(E_{t}\oplus\varepsilon) \tag{1}\]  
where \(M_{\text{obj}}\) represents the dynamic object mask generated by semantic segmentation, \(E_{t}\) denotes the set of points identified as outliers through geometric verification and feature matching in the current frame, and \(\oplus\varepsilon\) represents the morphological dilation operation on the outlier set with a kernel size of \(\varepsilon\). The parameter \(\varepsilon\) is empirically set to 50 pixels, a value that was determined through extensive comparative experiments on the KITTI and TUM RGB-D datasets. This setting achieves a balance between dynamic and static regions.