You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pointtree/instance_segmentation/_tree_x_algorithm.py
+89-38Lines changed: 89 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
importitertools
6
6
importmultiprocessing
7
7
frompathlibimportPath
8
-
fromtypingimportAny, Dict, List, Literal, Optional, Tuple, Union
8
+
fromtypingimportAny, cast, Dict, List, Literal, Optional, Tuple, Union
9
9
10
10
fromcircle_detectionimportMEstimator, Ransac
11
11
importnumpyasnp
@@ -115,7 +115,12 @@ class TreeXAlgorithm(InstanceSegmentationAlgorithm): # pylint: disable=too-many
115
115
.. rubric:: 3. Detection of Tree Stems
116
116
117
117
The aim of this step is to identify clusters of points that represent individual tree stems, i.e., each stem should
118
-
be represented by a single cluster. For this purpose, a horizontal layer is extracted from the point cloud that
118
+
be represented by a single cluster. If the stem positions and diameters at breast height are already known (e.g.,
119
+
from field measurements), this step can be skipped entirely by passing the known stem positions and diameters to the
120
+
:code:`stem_positions` and :code:`stem_diameters` parameters of :code:`__call__`. In that case, the stem detection described below is not executed, and the provided stem positions and diameters are
121
+
used directly as input to the subsequent region growing step.
122
+
123
+
For this purpose, a horizontal layer is extracted from the point cloud that
119
124
contains all points within a certain height range above the terrain (the height range is defined by
120
125
:code:`stem_search_min_z` and :code:`stem_search_max_z`). This layer should be chosen so that it contains all tree
121
126
stems and as few other objects as possible. The points within this slice are downsampled using voxel-based
@@ -293,12 +298,14 @@ class TreeXAlgorithm(InstanceSegmentationAlgorithm): # pylint: disable=too-many
293
298
points to be processed or the maximum number of iterations is reached.
294
299
295
300
To select the initial seed points for a given tree, the following approach is used: (1) All points that were
296
-
assigned to the respective stem during the stem detection stage are used as seed points. (2) Additionally, a
297
-
cylinder with a height of :code:`tree_seg_seed_layer_height` and a diameter of
298
-
:code:`tree_seg_seed_diameter_factor * d` is considered, where :code:`d` is the tree's
299
-
stem diameter at breast height, which has been computed in the previous step. The cylinder's center is
300
-
positioned at the stem center at breast height, which also has been computed in the previous stage. All points
301
-
within the cylinder that have not yet been selected as seed points for other trees are selected as seed points.
301
+
assigned to the respective stem during the stem detection stage are used as seed points (if the stem detection
302
+
stage was skipped because stem positions and diameters were directly provided by the user, this source of seed
303
+
points is not available). (2) Additionally, a cylinder with a height of :code:`tree_seg_seed_layer_height` and a
304
+
diameter of :code:`tree_seg_seed_diameter_factor * d` is considered, where :code:`d` is the tree's
305
+
stem diameter at breast height, which has either been computed in the previous step or provided by the user. The
306
+
cylinder's center is positioned at the stem center at breast height, which has likewise either been computed in
307
+
the previous stage or provided by the user. All points within the cylinder that have not yet been selected as
308
+
seed points for other trees are selected as seed points.
302
309
303
310
The search radius for the iterative region growing procedure is set as follows: First, the search radius is set
304
311
to the voxel size used for voxel-based subsampling, which is done before starting the region growing procedure.
0 commit comments