View source: R/tree_detection.R
maxima_selection | R Documentation |
In a maxima image (output of maxima_detection
), sets values to
zero for pixels which:
values in the initial image (from which maxima were detected) are below a threshold
values in the maxima image (corresponding to the radius of the neighborhood where they are global maxima) are below a threshold depending on the initial image value.
Make sure that the max.width
parameter in maxima_detection
is consistent with the selection parameters (e.g. do not select with
dmin = 7
if values were only tested up to max.width
the default
value which is approx. 5.5 m).
maxima_selection(maxi, dem_nl, hmin = 5, dmin = 0, dprop = 0.05)
maxi |
cimg object or SpatRaster object. image with local maxima
(typically output from |
dem_nl |
cimg object or SpatRaster object. initial image from which maxima were detected |
hmin |
numeric. minimum value in initial image for a maximum to be selected |
dmin |
numeric. intercept term for selection of maxima depending on
neighborhood radius: |
dprop |
numeric. proportional term for selection of maxima depending on
neighborhood radius: |
A cimg object or SpatRaster object which values are the radius (n) in meter of the square window (width 2n+1) where the center pixel is global maximum and which fulfill the selection criteria
maxima_detection
, tree_segmentation
data(chm_chablais3)
chm_chablais3 <- terra::rast(chm_chablais3)
# maxima detection
maxi <- maxima_detection(chm_chablais3)
# several maxima selection settings
selected_maxi_hmin <- maxima_selection(maxi, chm_chablais3, hmin = 15)
selected_maxi_dm <- maxima_selection(maxi, chm_chablais3, dmin = 2.5)
selected_maxi <- maxima_selection(maxi, chm_chablais3, dmin = 1, dprop = 0.1)
# corresponding count number of remaining maxima
table(terra::values(maxi))
table(terra::values(selected_maxi_hmin))
table(terra::values(selected_maxi_dm))
table(terra::values(selected_maxi))
# plot original image
terra::plot(chm_chablais3, main = "Initial image")
# plot maxima images, original and first case
terra::plot(maxi, main = "Local maxima")
terra::plot(selected_maxi, main = "Selected maxima")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.