---
title: Corrective Blurry KNN for Robust SLAM
url: https://www.emergentmind.com/topics/corrective-blurry-knn-cb-knn
type: topic
---

# Corrective Blurry KNN for Robust SLAM

Corrective Blurry K-Nearest Neighbor (CB-KNN) is an adaptive smoothing mechanism designed for 3D Gaussian Splatting (3DGS)-based SLAM pipelines, optimizing the rasterization process against parameter noise in Gaussian map representation. By introducing a controlled local blur via dynamic correction of RGB values and 2D locations of the K-nearest neighboring Gaussians at each image pixel, CB-KNN regularizes outlier splats and delivers improved robustness in camera pose tracking, while preserving mapping quality.

## 1. Problem Motivation and Conceptual Underpinning

In 3DGS-based SLAM, a scene is modeled as a set $G = \{g_1, \ldots, g_N\}$ of $N$ splats, with each Gaussian $g_i = (u_i, \sigma_i, r_i, c_i)$ representing spatial location, opacity, radius, and color respectively. SLAM system updates to these parameters, driven by noisy RGB-D sensor data, often result in splats with substantial inaccuracies, particularly near scene borders. Conventional rasterization yields sharp local footprints, so deviations in individual Gaussians propagate as spurious speckles or holes in the rendered image, undermining photometric alignment and pose optimization.

CB-KNN modifies standard rasterization by widening the influence of each Gaussian via an adaptive blur—temporarily blending parameter values among K spatially proximate neighbors per rendering pixel. This acts as a regularization term, mitigating deleterious effects from outliers and stabilizing SLAM tracking. The CB-KNN adjustments are strictly ephemeral and do not overwrite the canonical scene map [2511.23221].

## 2. Mathematical Formulation and Local Corrective Updates

The CB-KNN algorithm operates on pixels in the rendered image domain. For pixel $p = (u, v)$, let $G_p = \{g_{p1}, \ldots, g_{pK}\}$ denote the K Gaussians with centers $\mu_{pj}$ closest to $p$ under camera projection $\pi$.

- **Smoothing Kernel:**  
  For Gaussian $g_i$ at $u_i$, its attenuation at $p$ is:
  $$
  f_i(p) = \sigma_i \exp\left(-\frac{\|\pi(u_i)-p\|^2}{r_i^2}\right)
  $$
  Denoted $K(x; \mu_i, r_i, \sigma_i)$ for the kernel.

- **Color Correction:** For $g_{pj}$, obtain its normalized weight:
  $$
  \omega_{pj} = \frac{f_{pj}(p)}{\sum_{g_{pl} \in G_p} f_{pl}(p)}
  $$
  The corrected color:
  $$
  c'_{pj} = \sum_{g_{pl} \in G_p} \omega_{pl} c_{pl}
  $$

- **Position Correction:** Calculate centroid $C_p$ of 2D projections:
  $$
  C_p = \frac{1}{K} \sum_{g_{pj} \in G_p} \pi(u_{pj})
  $$
  Shift each $\pi(u_{pj})$ toward $C_p$ by $\alpha$:
  $$
  \pi(u'_{pj}) = \pi(u_{pj}) + \alpha \frac{C_p - \pi(u_{pj})}{\|C_p - \pi(u_{pj})\| + \varepsilon}
  $$
  $u'_{pj}$ is obtained by back-lifting $\pi(u'_{pj})$ to 3D along the viewing ray.

Rendering then proceeds via standard alpha-compositing on the corrected local set $G'_p = \{u'_{pj}, r_{pj}, \sigma_{pj}, c'_{pj}\}$:
- Color: $C(p) = \sum_{k=1}^K c'_{pk} f'_{pk}(p) \prod_{j<k}(1 - f'_{pj}(p))$
- Depth: $D(p) = \sum_{k=1}^K d'_{pk} f'_{pk}(p) \prod_{j<k}(1 - f'_{pj}(p))$
- Contour: $S(p) = \sum_{k=1}^K f'_{pk}(p) \prod_{j<k}(1 - f'_{pj}(p))$

## 3. Integration in SLAM Workflow

CB-KNN operates selectively, engaging only in keyframes during SLAM optimization. The principal steps are:

1. **Map Initialization**: Generate initial $G$ from early frames via differentiable rendering with photometric/depth loss minimization.
2. **Tracking Loop**:
   - Predict pose via constant-velocity.
   - For non-keyframes, render using original $G$ (no CB-KNN).
   - For keyframes:
     - At each pixel $p$, select $G_p$, apply color and position corrections as above, and render smoothed outputs $C(p), D(p), S(p)$.
     - Optimize pose $E_t$ by minimizing:
       $$
       L = \sum_{p:\,S(p)>0.99} \left[ |D(p)-D_{GT}(p)| + 0.6 |C(p)-C_{GT}(p)| \right]
       $$
   - **Densification**: Add new Gaussians where $S(p) < 0.5$ or depth error is high.
   - **Map Update**: Prune/optimize $G$ via small-scale backpropagation on recent keyframes using SSIM and $L_1$ color/depth loss.

## 4. Empirical Performance and Computational Profile

Extensive evaluation of CB-KNN in [2511.23221] demonstrates:

- **Absolute Trajectory Error (ATE, RMSE):**  
  - Replica: reduced from 0.39 cm to 0.32 cm (vs SplaTAM baseline)
  - TUM-RGBD: 3.31 cm $\rightarrow$ 3.18 cm
  - ScanNet (scene 0181): 13.43 cm $\rightarrow$ 12.48 cm
- **Relative Pose Error (RPE):** 20–30% reduction in drift.
- **Rendering Metrics:** PSNR/SSIM/LPIPS on par with or improved over baseline (e.g., PSNR +1 dB on TUM-RGBD).
- **Runtime Overhead:**  
  - Keyframe CB-KNN: $\sim$3.4 ms (baseline: 3.05 ms)
  - Overall pipeline: $\sim$0.43 FPS (baseline: 0.31 FPS)
  - Additional per-frame GPU cost $<$10% (A40 GPU).

## 5. Hyperparameter Selection and Adaptive Behavior

CB-KNN’s principal hyperparameters govern both smoothing strength and computational efficiency:

- **K (Neighbors):**  
  Baseline $K_0 = 8$; dynamically adapted per keyframe:
  $$
  K = K_0 \cdot \max\left(0.5, 1 - \beta \frac{\gamma}{\rho+\varepsilon}\right)
  $$
  where $\rho$ is local Gaussian density, $\gamma$ is normalized motion amplitude, $\beta=0.3$. K increases in low-density or high-motion regions for extra smoothing, decreases where scene is static or densely mapped to preserve detail.
- **$\alpha$ (Offset Coefficient):** Range $[0.1,0.3]$, with practical value $\approx 0.2$. Larger $\alpha$ enforces stronger blur at risk of over-smoothing.
- **Efficiency:** Only applied on keyframes and per-pixel on K neighbors, guaranteeing that cost does not scale with full Gaussian count $N$.

## 6. Relationships to Prior Methods and Broader Implications

CB-KNN distinguishes itself from prior SLAM rasterization strategies by shifting focus from perfect scene fidelity to stable tracking under parameter noise. Unlike purely loss-minimization or full-pipeline redesign approaches, CB-KNN applies a targeted, local regularization without modifying the underlying 3DGS map. This suggests a broader principle: augmenting rendering smoothness during pose optimization can offer substantial gains in robustness, with negligible sacrifice in mapping quality. A plausible implication is the utility of similar adaptive local smoothing strategies for other differentiable rendering-based visual SLAM systems.

## 7. Practical Summary and Implementation Considerations

CB-KNN constitutes a lightweight, easily integrated rasterization module for SLAM. It executes all corrections as transitory on-the-fly computations during keyframe rendering, ensuring mapping integrity while delivering large improvements in pose tracking accuracy. All methodology and empirical findings are detailed in "Robust 3DGS-based SLAM via Adaptive Kernel Smoothing" [2511.23221].

Source: https://www.emergentmind.com/topics/corrective-blurry-knn-cb-knn