# Geometric Characterization of Vines from 3D Point Clouds Obtained with Laser Scanner Systems
## 2 Materials and Methods
### Algorithms for Volume Calculation
#### 2.5.2 Volume Calculation with the OctoMap Algorithm  
OctoMap is an algorithm, programmed as an open-source C++ library, to generate volumetric 3D environment models [50]. 3D maps are created by taking the 3D range measurements afflicted with underlying uncertainty. Multiple uncertain measurements are fused into a robust estimate of the true state of the environment as a probabilistic occupancy estimation. The OctoMap mapping framework is based on octrees. Octrees are hierarchical data structures for spatial subdivisions in 3D [58; 59]. Space is segmented in cubic volumes (usually called voxels), which represent each node of  
\begin{table}
\begin{tabular}{c c c} \hline \hline  
the octree. Cubic volumes are recursively subdivided into eight subvolumes until the given minimum voxel size is reached (Figure 2 in [50] or Figure 8c). The resolution of the octree is determined by this minimum voxel size (Figure 8). The tree can be cut at any level to obtain a coarser subdivision if the inner nodes are maintained accordingly [50].  
Voxels are treated as Boolean data, where initialized voxels are measured as an occupied space (1), and null (0) voxels are free or unknown spaces. It should be noted that we only measured the face of the object shown from the position of the equipment, with existing occlusions. Therefore, each measurement establishes free voxels between the observer and the detected surface (occupied voxel), and all those behind are defined as unknown voxels.  
OctoMap creates maps with low memory consumption and fast access time. This contribution offers an efficient way of scanning and the possibility of achieving multiple measurements that can be fused in an accurate 3D scanned environment. In contrast to other expeditious approaches focused on the 3D segmentation of single measurements, OctoMap is able to integrate several measurements into a model of the environment.  
Taking advantage of the flexibility of writing data, this framework ensures the updatability of the mapped area, as well as its resolution, and copes with the sensor noise. The state of a voxel (occupied, free, or unknown) can be redefined if the number of observations with different states is higher than the times it was previously observed with its initial state.  
Furthermore, the appropriate formulas in the algorithm control the possibility of a voxel to be changed based on its neighbors and the number of times that it has been modified. Thus, the quantity of the data is reduced to the number of voxels that must be maintained. This clamping method is lossless because its thresholds avoid the losses of full probabilities.  
The subprocess called OctoMap is an adaptation of the OctoMap algorithm [50] for the purpose of estimating the volume of vines. The editable parameters for the processing point clouds with our adapted algorithm are listed in Table 5.  
Figure 8: Example of VSAOs at voxel resolutions. (**a**) Real VSAO. (**b**) 3D point cloud from TLS. (**c**) Voxelization. Voxel resolutions of (**d**) 0.04; (**e**) 0.02; and (**f**) 0.01 m.