## 3 Methodology
### Foreground-Background Segmentation  
Traditional foreground-background segmentation typically operates at the 2D level. In contrast, we perform segmentation using both LiDAR-based and visual 3D bounding boxes, defining dynamic human bodies as the foreground and all other objects as the background. The moving objects in the scene, denoted as \(\{O_{N},\ldots,O_{M}\}=\{O_{i}\}_{i=N}^{M}\), are tracked and enclosed within 3D bounding boxes, represented by the set \(\{B_{N},\ldots,B_{M}\}=\{B_{i}\}_{i=N}^{M}\). As illustrated in Figure 2, each bounding box \(B_{i}=\{P_{ci},h_{i},w_{i},l_{i}\}\), where \(P_{ci}=\{x_{ci},y_{ci},z_{ci}\}^{T}\) represents the center coordinates of the 3D bounding box \(B_{i}\), with \(h_{i}\), \(w_{i}\), and \(l_{i}\) corresponding to its height, width, and length, respectively, and the subscript \(i\) referring to the specific object. To achieve this goal, we maintain a global dynamic list \(L\) in which each element corresponds to the dynamic mask \(D_{i}\) of a moving object \(O_{i}\). This list is defined as \(L=\{D_{i}\}_{i=N}^{M}\), representing the masks of all detected moving objects. The mask \(D_{i}=\{p_{li},p_{ri}\}\) is defined as follows:  
\[p_{i1}=\left((RP_{i})_{x}+T_{x}-\frac{w_{i}}{2},(RP_{i})_{y}+T_{y}-\frac{l_{i} }{2}\right), \tag{1}\]  
\[p_{i2}=\left((RP_{i})_{x}+T_{x}+\frac{w_{i}}{2},(RP_{i})_{y}+T_{y}+\frac{l_{i} }{2}\right), \tag{2}\]  
where \(R\) and \(T\) represent rotation and translation, respectively, with \(R\) being the rotation matrix and \(T\) the translation vector. Based on this, we optimize the detection process by incorporating weight assessments for points within dynamic object masks. We utilize a deep learning-based visual model such as Mask R-CNN or PointPillars for 3D segmentation,  
Figure 1: Overall framework of our system. The figure illustrates the architecture of the proposed 3 DGS-based SLAM system integrating LiDAR and vision data for dynamic scene tracking and reconstruction. The input (**left**) shows raw sensor data, while the output (**right**) demonstrates the reconstructed static scene with dynamic objects removed. Figure 2: Comparison of mapping results on the KITTI dataset. generating the visual segmentation mask \(V_{i}\). We then fuse the visual segmentation mask \(V_{i}\) with the LiDAR segmentation mask \(D_{i}\) to form the composite mask \(C_{i}\):  
\[C_{i}=D_{i}\cup V_{i}. \tag{3}\]  
To enhance this process, we introduce a distance-based dynamic weight \(w_{\text{dyn}}(p)\) for the existing mask representation \(D_{i}=\{p_{li},p_{li}\}\). For each point \(p\) in the mask \(D_{i}\), we apply a dynamic weight based on the point's distance \(D(p)\) to the 3D box. Let \(D_{\text{max}}\) denote the maximum size or reference distance of the 3D box. The distance \(D(p)\) from point \(p\) to the interior of the box is used to adjust the point's weight. The closer the point to the box, the higher the weight, indicating a higher likelihood of it being dynamic; conversely, the farther the distance, the lower the weight, suggesting a higher likelihood of it being static. The adjustment formula is provided by  
\[w_{\text{dyn}}(p)=1-\frac{D(p)}{D_{\text{max}}}. \tag{4}\]  
Next, we calculate the comprehensive weight \(W(p)\) for each point in the mask, considering both the point's occupancy rate \(\phi(p)\) and its dynamic weight \(w_{\text{dyn}}(p)\):  
\[W(p)=\phi(p)\cdot w_{\text{dyn}}(p). \tag{5}\]  
Based on the comprehensive weight \(W(p)\), we determine whether to retain or remove a point according to a predefined threshold. For each point \(p\) in the composite mask \(C_{i}\), we calculate its comprehensive weight \(W(p)\) by considering both its dynamic weight \(w_{\text{dyn}}(p)\) and its uncertainty weight \(w_{\text{unc}}(p)\):  
\[W(p)=\phi(p)\cdot w_{\text{dyn}}(p)\cdot w_{\text{unc}}(p) \tag{6}\]  
where \(\phi(p)\) is the occupancy rate of point \(p\). Based on the comprehensive weight \(W(p)\), we determine whether to retain or remove a point according to a predefined threshold \(\theta\).