# Data and Knowledge-Driven Bridge Digital Twin Modeling for Smart Operation and Maintenance
## 4 Spatiotemporal Data Collection and Processing for Bridge Digital Twin
### The 3D Point Cloud Data Collection and Processing
#### 4.2.2 The 3D Point Cloud Data Preprocessing  
Following the collection of 3D point cloud data, preprocessing is essential to improve data quality and prepare them for further analysis. The raw data often contain noise and redundant points, which need to be removed using noise removal algorithms (e.g., k-nearest neighbor, KNN) before further processing of the data. In addition, point cloud data obtained from different perspectives need to be aligned using control points, alignment functions or algorithms (e.g., iterative closest point (ICP) algorithms). To ensure accurate geometric modeling and reduce computational complexity, the following preprocessing steps are applied.  
First, noise caused by environmental factors, such as lighting conditions or sensor inaccuracies, must be removed. A statistical outlier removal technique is used to address this issue [39]. This method calculates the average distance between each point and its \(k\)-nearest neighbors to identify points that deviate significantly from their neighborhood, as shown in Equation (5):  
\[\overline{d_{i}}=\frac{1}{k}\sum_{j=1}^{k}d_{ij} \tag{5}\]  
where \(\overline{d_{i}}\) represents the average distance of point \(k\)-nearest neighbors, \(k\) is the number of nearest neighbors considered for each point, \(d_{ij}\) is the Euclidean distance between point \(i\) and its neighboring point \(j\).  
Points with average distances \(\overline{d_{i}}\) exceeding a predefined threshold are classified as noise and subsequently removed from the dataset. This step enhances the clarity and quality of the data.  
Second, when multiple scans of the same structure are taken from different viewpoints, the individual point clouds must be aligned. The iterative closest point (ICP) algorithm is employed to align point clouds by minimizing the Euclidean distance between corresponding points [40]. The objective function minimized by ICP is expressed as in Formula (6):  
\[E(R,T)=\sum_{i=1}^{N}\left\|p_{i}^{source}-\left(R\cdot p_{i}^{target}+T\right) \right\|^{2} \tag{6}\]  
where \(E(R,T)\) is the objective function representing the total squared distance between corresponding points in the source and target point clouds, \(N\) denotes the total number of points in the point clouds, \(p_{i}^{source}\) is the position vector of the point in the \(i\)-th point in the source point cloud, \(p_{i}^{target}\) is the position vector of the corresponding \(i\)-th point in the target point cloud, \(R\) is the rotation matrix aligning the two point clouds, and \(T\) is the translation vector shifting the point clouds.  
This process optimizes the rotation \(R\) and translation \(T\) to ensure that the point clouds are spatially consistent, forming a complete 3D representation of the structure.  
Finally, to reduce the computational burden while retaining the essential geometric characteristics of the data, a voxel grid filter is applied for downsampling [41]. This method divides the point cloud into a three-dimensional grid of voxels and replaces all points within each voxel with their centroid. The centroid \(C_{v}\) of a voxel \(V\) is calculated as in Formula (7):  
\[C_{v}=\frac{1}{\left|V\right|}\sum_{i=1}^{\left|V\right|}p_{i} \tag{7}\]  
where \(C_{v}\) is the centroid of voxel \(V\), \(\left|V\right|\) is the number of points contained within voxel \(V\), and \(p_{i}\) represents the position vector of the \(i\)-th point in the voxel.  
This step significantly reduces the number of points while preserving the overall geometric structure of the bridge, facilitating more efficient processing in the subsequent stages of analysis.  
By completing these preprocessing steps--noise removal, point cloud alignment, and downsampling--the 3D point cloud data are optimized for accurate geometric modeling and structural health monitoring.