alsdb.processing.trees.segment_trees#
- alsdb.processing.trees.segment_trees(provider: TileDBProvider, bbox: tuple[float, float, float, float] | None = None, year: int | None = None, min_points: int = 10, min_height: float = 3.0, radius: float = 2.0, adaptive_radius: bool = False, voxel_size: float | None = None, tile_size: float | None = None, tile_buffer: float = 30.0, n_workers: int = 1, crown_fraction: float = 0.5) tuple[ndarray, DataFrame][source]#
Segment individual trees using
filters.litree.- Parameters:
provider – TileDB provider instance.
bbox – Spatial filter
(min_x, min_y, max_x, max_y). Uses the full array domain whenNone.year – Optional survey year filter.
min_points – Minimum ALS points for a cluster to be labelled as a tree.
min_height – Minimum tree height in metres.
radius –
filters.litreesearch radius (m). Used when adaptive_radius isFalse. Increase for sparser clouds or wider-crowned trees.adaptive_radius – If
True, compute the search radius per tile from P75 HAG usingwf(h) = 0.07 * h + 0.6(Murphy et al. lidar-forestry approach). Overrides radius.voxel_size – Poisson disk sampling radius (m) applied before
filters.litreeto speed up the graph build.0.5m is a good starting point for dense ALS (> 5 pts/m²).Nonedisables downsampling.tile_size – Sub-tile side length (m). When provided the area is partitioned into tiles and processed in parallel (recommended for areas > 0.5 km²).
Noneprocesses the full bbox in one pass.tile_buffer – Overlap buffer (m) added to each tile query so trees at edges are fully captured. Default 30 m.
n_workers – Thread pool size. Effective only when
tile_sizeis set.crown_fraction – Fraction of tree height used as the lower bound for crown-area computation (default 0.5 = upper half of each tree). Only points at or above
crown_fraction × heightcontribute to the convex hull used forcrown_areaandcrown_radius. Reducing this value includes more understory returns and will increase the area estimate; increasing it focuses on the uppermost crown.
- Returns:
points (np.ndarray) – Structured array with
HeightAboveGroundandTreeIDfields.TreeID = 0means unassigned. Points from all tiles are concatenated; TreeIDs are re-numbered 1 … N globally.trees (pd.DataFrame) – One row per tree, sorted by descending height. Empty if none found.