Learn R Programming

lidR (version 3.2.3)

find_localmaxima: Local Maximum Filter

Description

Generic local maximum filter. For individual tree detection use find_trees with the lmf algorithm that is more adequate for ITD. This function is a more generic method for multiple purposes other than tree segmentation. This function is natively parallelized with OpenMP.

Usage

find_localmaxima(las, w, filter = NULL)

Arguments

las

An object of class LAS

w

numeric. Window shape. 1 number for the diameter of a disc, 2 numbers for a rectangle (width, height), 3 numbers for an oriented rectangle (width, height, angle). The angle must be in radians.

filter

formula. Memory efficient way to work only with a subset of the data without creating a copy of the data.

Value

SpatialPointsDataFrame with attributes from the corresponding point in the LAS object,

Examples

Run this code
# NOT RUN {
LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
las <- readLAS(LASfile, select = "xyzi", filter = "-drop_z_below 0 -keep_random_fraction 0.5")

# Using a 20x5 rectangle with a 45 degrees angle.
# This won't find the tree properly in the general case
# but may find some oriented structure.
lm = find_localmaxima(las, c(20, 5, pi/4))
plot(lm)
# }

Run the code above in your browser using DataLab