h1. HT5 - Measuring 1.30 m diameter automatically |{width:4000px;text-align:left;border-color:transparent}. !/attachments/download/19/fr_FR.png! [[Fr_dbhAuto|...version française de cette page]] | notice<>. This tutorial uses the following script in the *Computree* *HowTo* subfolder: _HT5_Measuring_DBH_automatically.xsct2_ h2. Objectives p<>. This tutorial shows how to : # Automatically detect individual tree stems, tree positions and diameters at breast heigh (DBH) from terrestrial laser scans (TLS) # Understand and configure steps' parameters # Export results attributes to .csv file h2. Load data Please refer to tutorial [[En_loadCloud_|HT1 - Load, visualize, crop and export a T-Lidar point cloud]] at the +Load a ploint cloud+ section. tip<>. For best results, use multiple scans. Stem detection is highly affected by data quality! We seek to maximize objects' reprensation and minimize occlusion in the point cloud. h2. Plot extraction (optional step) Please refer to tutorial [[En_loadCloud_|HT1 - Load, visualize, crop and export a T-Lidar point cloud]] at the +Plot extraction+ section. h2. Points density reduction (optional step) The _PB_stepReducePointsDensity_ step is found in the _base_ plugin (_base_ / _Points clouds_ / _Points density reduction_). If you are using multiple scans, it is recommended to add a step for point density reduction to decrease calculation time. Depending on your computer performances, a 0.5 or 1 cm *Grid resolution* should be fine. notice<>. A high resolution point cloud (a large number of points per cubic centimeter) increases the calculation time. !density_EN.jpg! h2. Ground / vegetation separation Please refer to tutorial [[En_extractSoil_|HT2 - Create a Digital Terrain Model from a T-Lidar point cloud]]. h2. Horizontal clustering The _OE_StepHorizontalClustering04_ step is found in the _onfensamv2_ plugin (_onfensamv2_ / _Clustering by horizontal slices_) warning<>. Make sure that the input results are +Vegetation points+! To access this window right click on the step and select +Config. input results+ !horizontal_clustering_input_EN.jpg! This step creates horixontal clusters. The scene is divided in horizontal layers of a specified *Thickness*. Then, for each layer, points are gathered in clusters according to the distance between them. The *Maximum distance between two points of the same group* must be indicated. !horizontal_clustering_EN.jpg! Results of the horizontal clustering: notice<>. Each color represents an individual cluster. !clusters.jpg! h2. Cluster filtering The _OE_StepFilterClustersBySize_ step is found in the _onfensamv2_ plugin (_onfensamv2_ / _Filtering of clusters by points number_) This step filters undersized clusters. Clusters with a number of points strictly lower than the *Minimum points number* are eliminated. notice<>. The point cloud resolution and the horinzontal layers' thickness from the previous step influence this parameter. If the number of points per cubic centimeter is low and the layers are thin, the number of points per cluster will be low from the beginning. !filter_cluster_by_size_EN.jpg! h2. Merge clusters in logs The _OE_StepDetectSection07_ step is found in the _onfensamv2_ plugin (_onfensamv2_ / _Vertical merging of clusters in logs_) This step verticaly aggregates clusters in sections (logs). A *Vertical distance threshold* is indicated to compare clusters in pairs. If both clusters' bounding boxes intersect on that distance threshold, clusters are merged. A log stops when there is a vertical break in the cluster. Scan occlusions or presence of a branch are commun causes. !detect_section_EN.jpg! Results of the clusters merging in logs: notice<>. Each color reprensents an individual log. !logs.jpg! h2. Filter logs The _OE_StepFilterGroupsByGroupsNumber_ step is found in the _onfensamv2_ plugin (_onfensamv2_ / _Filtering lvl 1 groups / number of lvl 2 groups_) This generic method removes groups (logs) that have a poor number of subgroups (clusters). Level 1 groups (logs) are eliminated if they got an insufficient *Level 2 number of groups* (clusters). This step is used to clear most of the small branches and false logs. !filter_group_EN.jpg! Results of the log filtering: !filtered_logs.jpg! h2. Merge neighbour sections The _OE_StepMergeNeighbourSections04_ step is found in the _onfensamv2_ plugin (_onfensamv2_ / _Merging of parallel logs_) This step merges adjacent logs. When there is occlusion in the point cloud, branches can be cut so that two logs are created instead of one: !parallel_log.jpg! First, all clusters of a log are recreates according to a specified *Thickness (in Z)*. Then, logs belonging to the same tree are merged. This tool takes the following parameters: * The *Search distance for neighbours* parameter is used for calculation optimization. * The *Maximum XY distance between cluster’s barycenters*. If the horizontal distance between compared barycenters is greater than this parameter, logs will not be merged. * The *Maximum Z distance between cluster’s centroid*. If the vertical distance between compared barycenters is greater than this parameter, logs will not be merged. * The *Maximum inscreasing factor* is used so that the merge does not create too much distance between the new barycenter and cluster points. An increasing factor of 2 means that the distance between the new barycenter and cluster points can be doubled. !merge_neighbor_EN.jpg! h2. Merge aligned logs The _OE_StepMergeEndToEndSections04_ step is found in the _onfensamv2_ plugin (_onfensamv2_ / _Merging of aligned logs_) This step merges logs that are aligned in direction. The step operates this way (see also the technical diagram below): * Clusters are recreated with the specified *Z-thickness of groups* * Logs are then compared in pairs. If the distance between two logs is lower than the *Maximum distance*, logs can be merged. * Imaginary lines between each log's clusters are created. The *Number of barycenters to consider* must be specified. * The maximal distance between the line and the end of the first log is calculated (maxDist). The distance between the first log's line and the second log's line must not be higher than maxDist * a *Multiplicative factor*. * A *Tolerated Z overlapping* is also specified. !merge_end_EN.jpg! Technical diagram: !schema_EN.jpg! Results of the fusion: notice<>. You can notice an exemple of vertical overlaping on the left image. !merge_align.jpg! h2. Set coordinates The _OE_StepSetFootCoordinatesVertically_ step is found in the _onfensamv2_ plugin (_onfensamv2_ / _Addition od a base coordinante by log // DTM_) warning<>. This step takes two input results: the +Digital Terrain Model+ and the +Merged logs+! !set_coordinates_input_EN.jpg! There are no parameters needed. This step sets coordinates for tree positions by projecting the lowest cluster on the MNT. h2. Fit and filter cylinders The _OE_StepFitAndFilterCylindersInSections_ step is found in the _onfensamv2_ plugin (_onfensamv2_ / _Fitting / Filtering of cylinders by log_) This step creates cylinders and filters them depending of their goodness of fit. The tool requires a *Minimum radius* and *Maximum radius* so that small or large trees are not represented. Cylinders can be filtered on the *Absolute error* and/or the *Relative error*. They also can be filtered on their verticality, a *Maximum vertical angle from solar zenith* must be specified. !fit_cylinders_EN.jpg! Results of the cylinder fitting: !cylinders.jpg! h2. Compute cylinders diameter The _OE_StepExtractDiametersFromCylinders_ step is found in the _onfensamv2_ plugin (_onfensamv2_ / _Computing of cylinders mean diameter by log_) This tool compute trees' diameter at breast height (DBH). In order to do that, a cercle is adjusted on a previously created cylinder. A *Bottom height* and a *Top height* for evaluation are specified. Cercles radii are calculated between these values in order to calculate a regression. The *Reference height* value (generally 1.30 meters) is interpolated of this regression. The *Maximal taper* is used to insure that no abberant cylinders are used in the calculation. A *Minimum number of cylinders to adjust a circle* is also specified. !extract_diameter_EN.jpg! h2. Results visualization To visualize the adjusted cercles , you must activate the results in the Step and Model managers. !visualization_EN.jpg! tip<>. A simple right click on +Diameter at 1.30m+ enables you to change the cercles color. To visualize the results attributes, activate !info.jpg! +Information ItemDrawable+ in the +Action+ tab and then select an object. !DHP.jpg! h2. Export attributes The _PB_CSVExporter_ step is found in the _base_ plugin (_base_ / _Exporters_ / _Export d’attributs (csv)_) First, select the input result. !Export_attributes_1_EN.jpg! Then, drag and drop attributes you wish to include in the file. !Export_attributes_2_EN.jpg! Finally, specify the path and file name. !Export_attributes_3_EN.jpg! tip<>. If you are using a script, right click on +Attributs/Items d’un groupe+ and then select +Config. input results+ to specify the attributes and +Config. parameters+ to specify the file name. _____ | [[En_tutorials|Back to How Tos list]]|