# Dynamic Downsampling Algorithm for 3D Point Cloud Map Based on Voxel Filtering
## 4 Methods  
In response to the issues of information loss and blurring in classic voxel filtering for point cloud maps, we present an improved dynamic downsampling algorithm for 3D point cloud maps based on voxel filtering. The proposed method aims to dynamically segment 3D point cloud maps, preserving both edge information and crucial feature details. Moreover, this method adaptively segments voxels into various sizes, depending on the local density variations within the point cloud data, thereby reducing the need for manual intervention and parameter tuning. The dynamic voxel-based 3D point cloud map downsampling algorithm consists of two modules: dynamic downsamplingand point cloud edge extraction. In the former, downsampling operations are tailored based on the density of points within each voxel block of the point cloud map. Specifically, if a unit voxel block has a higher density, it is subdivided into smaller voxel blocks, whereas if a unit voxel block has a lower density, it is subdivided into larger voxel blocks. This adaptive approach allows for different downsampling operations on various voxel blocks, addressing the drawback of classic voxel filtering, which rather tends to blur object characteristics by uniformly processing each voxel block. The point cloud edge extraction module determines whether points within the cloud represent an object's edge by analyzing the angle feature values of their normal vectors. Points identified as object edges are preserved and then merged with the downsampled point cloud, resulting in the final, combined point cloud map. Figure 4: Voxel downsampling process schematic. The flowchart of the dynamic voxel-based 3D point cloud map downsampling algorithm improved by voxel filtering is illustrated in Figure 5. Accordingly, the implementation steps of the improved algorithm are described below. 1. Input point cloud data: We begin with the input of 3D point cloud data. 2. Calculation of the maximum voxel block: The maximum values along the \(x\)-, \(y\)-, and \(z\)-axes of the point cloud data, denoted by \(X_{\text{max}}\), \(Y_{\text{max}}\), and \(Z_{\text{max}}\), respectively, are determined. Additionally, the minimum values (\(X_{\text{min}}\), \(Y_{\text{min}}\), and \(Z_{\text{min}}\)) along these axes are also computed [34]. The edge length of the largest voxel block is determined by (2). \[ \begin{split} l_{x}&=X_{\text{max}}-X_{\text{min}} \\ l_{y}&=Y_{\text{max}}-Y_{\text{min}}\\ l_{z}&=Z_{\text{max}}-Z_{\text{min}}\end{split}  \tag{2}\]  
Thus, the largest voxel block is obtained, as shown in Figure 6.  
Figure 5: Flowchart of 3D point cloud map dynamic downsampling algorithm based on voxel filtering. 3. Voxel block division: The largest voxel block is divided into unit voxel blocks, with a designed edge length of \(L\)[35]. The division in three directions is described in (3). \[M =\left\lfloor\frac{l_{x}}{\text{cell}}\right\rfloor\] \[N =\left\lfloor\frac{l_{y}}{\text{cell}}\right\rfloor\] (3) \[L =\left\lfloor\frac{l_{z}}{\text{cell}}\right\rfloor\] The summation of unit voxel blocks is illustrated in Figure 7. 4. We count the number of points in each voxel block to obtain the point count collection for voxel blocks, denoted by \(NUM=(n_{1},n_{2},n_{3},\dots,n_{SUM})\). 5. Subdivision of voxel blocks: By mapping \((\min(NUM),\max(NUM))\) to \(\left(\frac{3}{4}\Pi,\Pi\right)\), we project the count of points within each unit voxel to the range of \(\left(\frac{3}{4}\Pi,\Pi\right)\). This calculation involves subdividing voxel blocks based on the side length of each unit voxel. According to the property defined in (4) and (5), it is possible to subdivide voxel blocks into different sizes based on the quantity of points within each unit voxel. The cutting principle is illustrated in Figure 8.  
Figure 6: Maximum voxel block. Figure 7: Subdivision of the Largest Voxel into Unit Voxels.