Delineate Crown
This module implements functions for delineating tree crowns from canopy height models and treetop locations.
DelineationParams
dataclass
Parameters for tree crown delineation methods.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
delineation_method
|
str
|
Method to use for delineation ("watershed" or "region_growing"). |
'watershed'
|
pixel_size
|
float
|
Resolution of the input canopy height model in meters. |
0.25
|
min_height
|
float
|
Minimum height threshold for including pixels in crowns. |
3.0
|
watershed_sigma
|
float
|
Sigma value for Gaussian smoothing in watershed method. |
0.5
|
max_crown_radius
|
float
|
Maximum expected crown radius in meters for region growing method. |
10.0
|
apex_inclusion
|
float
|
Minimum relative height of pixels to be included in the crown compared to the apex height. |
0.45
|
crown_threshold
|
float
|
Minimum relative height of pixels to be included in the crown compared to the current average height of the crown during region growing. |
0.55
|
Source code in src/phytospatial/lidar/delineate_crown.py
delineate_crowns(chm_input, treetops, params=DelineationParams(), tile_mode='auto', tile_size=1024, overlap=64)
Delineates tree crowns from a canopy height model (CHM) and treetop locations using specified parameters and processing strategy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chm_input
|
Union[str, Path, Raster]
|
Input canopy height model, either as a file path or a Raster object. |
required |
treetops
|
Vector
|
Vector layer containing the treetop locations as Point geometries. |
required |
params
|
DelineationParams
|
DelineationParams object containing parameters for the delineation methods. |
DelineationParams()
|
tile_mode
|
str
|
Tiling strategy for processing large rasters ('auto', 'in_memory', 'blocked', 'tiled'). |
'auto'
|
tile_size
|
int
|
Size of tiles to use if tiling is necessary. |
1024
|
overlap
|
int
|
Number of pixels to overlap between tiles to avoid edge effects. |
64
|
Yields:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: A dictionary containing the tree ID, height, delineation method used, and geometry of each detected tree crown as a Polygon. |
Source code in src/phytospatial/lidar/delineate_crown.py
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | |