tree_segmentation {lidaRtRee} | R Documentation |
Preprocessing and segmentation of raster image for tree identification
Description
global function for preprocessing (filtering), maxima detection and selection, segmentation and segmentation adjustment of a raster image.
Usage
tree_segmentation(dem, dtm = NULL, crown_prop = NULL, crown_hmin = NULL, ...)
Arguments
dem |
raster object or string indicating location of raster file (typically a canopy height model or a digital surface model; in the latter case the dtm parameter should be provided) |
dtm |
raster object or string indicating location of raster file with the terrain model. If provided, the maxima extraction and watershed segmentation are performed on the dem (this avoids the deformation of crown because of the normalisation with terrain), but maxima selection and segment adjustment are performed on 'dem-dtm' because the selection criteria are based on the height to terrain. |
crown_prop |
(deprecated) numeric. (overrides |
crown_hmin |
(deprecated) numeric. (overrides |
... |
arguments passed to functions |
Value
A SpatRaster with 4 layers: selected local maxima (values = distance to higher pixel), segments, non-linear preprocessed dem, smoothed preprocessed dem
References
Monnet, J.-M. 2011. Using airborne laser scanning for mountain forests mapping: Support vector regression for stand parameters estimation and unsupervised training for treetop detection. Ph.D. thesis. University of Grenoble, France. Section 6.2 https://theses.hal.science/tel-00652698/document
Monnet, J.-M., Mermin, E., Chanussot, J., Berger, F. 2010. Tree top detection using local maxima filtering: a parameter sensitivity analysis. Silvilaser 2010, the 10th International Conference on LiDAR Applications for Assessing Forest Ecosystems, September 14-17, Freiburg, Germany, 9 p. https://hal.science/hal-00523245/document
See Also
dem_filtering
, maxima_detection
,
maxima_selection
, segmentation
,
seg_adjust
, tree_extraction
,
tree_detection
Examples
data(chm_chablais3)
chm_chablais3 <- terra::rast(chm_chablais3)
# tree segmentation
segments <- tree_segmentation(chm_chablais3)
segments2 <- tree_segmentation(chm_chablais3,
nl_filter = "Median", nl_size = 3,
sigma = cbind(c(0.2, 0.8), c(0, 15)), dmin = 0, dprop = 0, hmin = 10,
crown_prop = 0.5, crown_hmin = 5
)
# plot initial image segments
terra::plot(chm_chablais3, main = "Initial image")
terra::plot(segments$smoothed_dem, main = "Filtered image")
terra::plot(segments$local_maxima, main = "Local maxima")
#
# replace segment with id 0 (not a tree) with NA
segments$segments_id[segments$segments_id == 0] <- NA
terra::plot(segments$segments_id %% 8, main = "Segments", col = rainbow(8))
#
# plot segmentation with other parameters
segments2$segments_id[segments2$segments_id == 0] <- NA
terra::plot(segments2$segments_id %% 8, main = "Segments2", col = rainbow(8))