maxima_selection {lidaRtRee}R Documentation

Image maxima selection based on values and neighborhood of local maxima

Description

In a maxima image (output of maxima_detection), sets values to zero for pixels which:

  1. values in the initial image (from which maxima were detected) are below a threshold

  2. 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).

Usage

maxima_selection(maxi, dem_nl, hmin = 5, dmin = 0, dprop = 0.05)

Arguments

maxi

cimg object or SpatRaster object. image with local maxima (typically output from maxima_detection, image values correspond to neighborhood radius on which pixels are global maxima in the initial image)

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: maxi >= dmin + dem_nl * dprop

dprop

numeric. proportional term for selection of maxima depending on neighborhood radius: maxi >= dmin + dem_nl * dprop

Value

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

See Also

maxima_detection, tree_segmentation

Examples

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")

[Package lidaRtRee version 4.0.5 Index]