# Geometric Characterization of Vines from 3D Point Clouds Obtained with Laser Scanner Systems
## 2 Materials and Methods
### Algorithms for Volume Calculation  
Several algorithms that help in the process of volume calculation from point clouds have already been developed [50; 51]. However, these are general algorithms that require adaptation and calibration for different object shapes, as well as sparse and noisy point clouds, such as in the case of vine trunk volume calculation. Other algorithms, such as the L\({}_{1}\)-medial skeleton [52], can help develop new algorithms for volume calculation, which is one of the main contributions of this paper. The shape of the vine trunks is highly irregular; these trunks are located in an adverse environment for data acquisition, which demands point cloud treatment, algorithm evaluation, calibration, and adaptation. This process should be incorporated in a tool that performs these tasks in an automatic manner. With the methodology and tool developed in this manuscript, these requirements are fulfilled. The proposed methodology includes the development, adaptation, and implementation of a set of algorithms developed in the C++ language and a classification algorithm implemented in MATLAB (Mathworks Inc., Massachusetts, USA); all of these algorithms have been integrated into a unique piece of software. The imported information includes:  
* A text file with the approximate coordinates for each vine base, which can be obtained with a GNSS-RTK or a high resolution orthoimage, among others. * A text file describing the main parameters of the project: the name, approximate dimension of the searched figure (Figure 6), input and output file paths, formats, coordinate reference systems, etc. * A point cloud in the LAS file format [53] or compressed LAZ. * A text file with the position of each single scan performed by TLS. Figure 5: Test area, location of the VSAOs, TLS stations, and MMS trajectory (EPSG:3857). Figure 6: Approximate squared envelope of a vine. Three strategies have been implemented and evaluated to calculate the volume occupied by the vine: (1) OctoMap [50], which is an algorithm to generate volumetric 3D environmental models based on voxelization of the occupied space; (2) a convex hull cluster (CHC) [51] that closes the convex envelope of previously clustered sets of points according to geometric and radiometric criteria; and (3) volume calculation from the trunk skeleton (VCTS), which obtains the volume of an object from the distance between each point of the cloud and the internal structure of the object, generated with the L\({}_{1}\)-medial skeleton [52] algorithm. These three algorithms will be described below. These are some volume calculation strategies that we have adapted to the characteristics of the point clouds captured by our TLS and MMS. However, none of these strategies are ready to be applied to the specific case of calculating the volume of vine trunks. In this paper, we describe the new developments and adaptations required for the case study of vine volume calculation. This is especially crucial in the case of MMS, where point cloud data are sparse and noisy, but whose applicability is higher due to the wider areas covered. Automated point cloud classification based on RGB values, point selection based on trunk shape, and the development, adaptation, and calibration of algorithms for volume calculation are the main contributions of this work. Before applying any of these three algorithms, the acquired point cloud should be preprocessed to produce a point cloud with a high quality and three-dimensional definition of the scanned object. If automated clipping, classification, and debugging processes are not enough to define the vine shapes, possible manual editing of the resulting point cloud can be performed. The latter is a step that should be avoided to ensure a highly automatic process.