# RD-SLAM: Real-Time Dense SLAM Using Gaussian Splatting
## 3 Materials and Methods
### Tracking  
In the tracking threads, we use G-ICP to estimate the camera pose. G-ICP introduces probabilistic information on top of ICP. While maintaining the speed and simplicity of ICP, G-ICP allows for adding outlier terms, measurement noise, and other probabilistic techniques, significantly improving the algorithm's robustness.  
For the first frame of the RGB-D camera input, the tracking step is skipped, and the camera pose is set to the identity. The obtained point cloud data are also added to G-ICP as target point clouds, and the pose is estimated from the second frame of the input image. G-ICP assumes the existence of point clouds sets \(A=\hat{a}_{i}\) and \(B=\hat{b}_{i}\), which generate A and B according to the Gaussian probability models \(a_{i}\sim\mathcal{N}\big{(}\hat{a}_{i},C_{i}^{A}\big{)}\) and \(b_{i}\sim\mathcal{N}\big{(}\hat{b}_{i},C_{i}^{B}\big{)}\). \(\hat{a}_{i}\) and \(\hat{b}_{i}\) are associated, \(a_{i}\) and \(b_{i}\) are the actual measurements of the point locations, and \(\big{\{}C_{i}^{A}\big{\}}\) and \(\big{\{}C_{i}^{B}\big{\}}\) are covariance matrices associated with the measurement points. The covariance of a 3D point is obtained by computing the covariance matrix of the k-nearest neighbors of the 3D point. G-ICP aims to find a transformation that maximally aligns the current frame point cloud \(a_{i}\) with the map point cloud \(b_{i}\). For the corresponding points \(\hat{a}_{i}\) and \(\hat{b}_{i}\), there exists a truth value \(\mathbf{T}^{*}=[\mathbf{R}^{*}|\mathbf{t}^{*}]\) such that \(\hat{b}_{i}=\mathbf{T}^{*}\hat{a}_{i}\). The error term of an arbitrary rigid transformation \(\mathbf{T}\) is:  
\[d_{i}^{(\mathbf{T})}=b_{i}-\mathbf{T}a_{i}. \tag{6}\]  
Since \(a_{i}\) and \(b_{i}\) are independent of each other and both satisfy Gaussian distribution, \(d_{i}^{(\mathbf{T}^{*})}\) also satisfies Gaussian distribution:  
\[\begin{split} d_{i}^{(\mathbf{T}^{*})}&\sim \mathcal{N}\ \left(\hat{b}_{i}-(\mathbf{T}^{*})\hat{a}_{i},C_{i}^{B}+(\mathbf{T}^{*})C_{i}^ {A}(\mathbf{T}^{*})^{T}\right)\\ &=\mathcal{N}\Big{(}0,C_{i}^{B}+(\mathbf{T}^{*})C_{i}^{A}( \mathbf{T}^{*})^{T}\Big{)}\end{split} \tag{7}\]  
Figure 3: 3D Gaussian operation flow process.  
**T** can be viewed as a parameter to be estimated in the \(d_{i}^{\text{(T)}}\) probability distribution. We use maximum likelihood estimation (MLE) to iteratively calculate \(\mathbf{T}^{*}\):  
\[\mathbf{T}^{*}=\underset{\mathbf{T}}{\text{argmax}}{\prod}_{i}p\Big{(}d_{i}^{ \text{(T)}}\Big{)}=\underset{\mathbf{T}}{\text{argmax}}{\sum}_{i}\log\Big{(}p \Big{(}d_{i}^{\text{(T)}}\Big{)}\Big{)}. \tag{8}\]  
The above equation can be simplified as:  
\[\mathbf{T}^{*}=\underset{\mathbf{T}}{\text{argmin}}{\sum}_{i}{d_{i}^{\text{(T )}}}^{T}\Big{(}C_{i}^{B}+\mathbf{T}C_{i}^{A}\mathbf{T}^{T}\Big{)}^{-1}d_{i}^{ \text{(T)}}, \tag{9}\]  
\(\mathbf{T}^{*}=[\mathbf{R}^{*}|\mathbf{t}^{*}]\) is the camera pose estimated by the system.  
Since 3D Gaussian needs good observation coverage and considering the densification strategy, we divide the keyframes into tracking and mapping keyframes, as shown in Figure 4. We use G-ICP to calculate the match ratio of the current frame point cloud to the map point cloud. The frame is selected as the tracking keyframe if the matching ratio is below the threshold. If the relative rotation of the current frame to the latest keyframe is above the threshold, the frame is selected as the mapping keyframe. The relative rotation here is expressed using Euler angles, and to ensure the stability of the results, we add the Euler angles on the three axes and compare them to a single threshold. In the tracking keyframes, only 3D Gaussians that do not overlap with the existing map are added to the optimization. The opposite is true in the mapping keyframe, where only 3D Gaussians that overlap with the existing map are added to the optimization.