# Testing the Effectiveness of Voxels for Structural Analysis
## 3 Results
### Voxelization  
Regarding voxelization, the challenge associated with intricate geometries, particularly those of cultural heritage artifacts, is that voxelization algorithms tend to oversimplify. A robust algorithm for voxel processing is referenced in [48]. The open-source Open3D library [49] was employed, utilizing the voxel_down_sample (self, voxel_size) function, which yields an output point cloud represented by single voxels, with normals and colors averaged when available. The methodology employed consists of the following steps:  
* Applying a voxel size constraint for downsampling. * Explanation of the voxel grid's resolution. * Generation of a voxel grid. * Generation of a two-state occupancy grid. * For each voxel, the corresponding index within a binary grid is triggered. * Implementation of the Marching Cubes method for surface mesh extraction. * The STL file is subsequently stored. Only the point clouds of two objects have been voxelized, the scorpionide and the pillar, because of their geometric complexity and different dimensions (Figure 4). The process in the voxel algorithm follows different steps:  
Figure 4: \(Cont.\)Voxelization is performed using Open3D's VoxelGrid.create_from_point_cloud() function. Voxelization Parameters:
* voxel_size = 0.2: Defines the resolution of the voxel grid. A smaller value results in a higher resolution but increases processing time and memory usage. The value set for this project was 0.2 because, after several tries, it was the best compromise between the best result in terms of accuracy of data obtained from the process and the exploitation of memory. The process started with the value of 0.01 and increased it considering the use of resources in terms of memory and CPU of the computer. Of course, the decision was made considering the processing effort and the accuracy of results. After several tries, 0.2 was the best choice considering the models of the object tested. It is probable that it will be possible to decrease the value in the case of smaller objects, while with bigger, more complex objects, the value will need to be increased. The voxel grid is then saved for future use. Figure 4: The voxel models of the pillar, (**a**) scorpionide (**b**), and the chair from the Royal Palace of Caserta (**c**). A binary occupancy grid is generated from the voxel grid. For each voxel, its corresponding index in the binary grid is activated. The Marching Cubes algorithm is then applied to extract the mesh surface. Marching Cubes Parameters:  
* Level = 0.5: Defines the isovalue for surface extraction. A value of 0.5 ensures that the generated mesh follows the midpoint of occupied and unoccupied voxels. * voxel_grid.get_min_bound())/voxel_size grid_dim = grid_dim.astype(int) + 1 binary_grid = np.zeros(grid_dim, dtype = bool) for voxel in voxel_grid.get_voxels(): binary_grid[voxel.grid_index [0], voxel.grid_index [1], voxel.grid_index [2]] = True verts, faces, normals, _ = measure.marching_cubes(binary_grid, level = 0.5, spacing = (voxel_size, voxel_size, voxel_size)) mesh_data = mesh.Mesh(np.zeros(faces.shape [0], dtype = mesh.Mesh.dtype)) for i, face in enumerate(faces): for j in range(3): mesh_data.vectors[i][j] = verts[face[j]. :] mesh_data.save(output_file) stl_mesh = trimesh.load(output_file) stl_mesh.show() The complete workflow followed is summarized in Figure 5.  
Figure 5: Diagram of the workflow followed. The resulting volumetric models present two different levels of accuracy. Visually, it is evident that the model of the pillar is missing many features, probably because the point cloud was too sparse. This may be due to aggressive application of the denoising algorithm or the photogrammetric processing, which resulted in an incomplete model. The volumetric model of the scorpionide, on the other hand, is more accurate and visually complete. Finally, the chair resulted in a more accurate voxel model, likely because of the geometry of the surveyed object and the fact that it was possible to capture it in 360\({}^{\circ}\), both above and below.