Individual tree detection

Individual tree detection function that find the position of the trees using several possible algorithms.

tree_detection(las, algorithm)

An object of class LAS or LAScatalog. Can also be a RasterLayer representing a canopy height model, in which case it is processed like a regularly-spaced point cloud.


An algorithm for individual tree detection. lidR has: lmf and manual. More experimental algorithms may be found in the package lidRplugins.


A SpatialPointsDataFrame with an attribute Z for the tree tops and treeID with an individual ID for each tree.

Supported processing options

Supported processing options for a LAScatalog (in bold). For more details see the LAScatalog engine documentation:

  • chunk size: How much data is loaded at once.

  • chunk buffer*: Mandatory to get a continuous output without edge effects. The buffer is always removed once processed and will never be returned either in R or in files.

  • chunk alignment: Align the processed chunks.

  • cores: How many cores are used.

  • progress: Displays a progression estimation.

  • output_files: Supported templates are {XLEFT}, {XRIGHT}, {YBOTTOM}, {YTOP}, {XCENTER}, {YCENTER} {ID} and, if chunk size is equal to 0 (processing by file), {ORIGINALFILENAME}.

  • laz_compression: write las or laz files

  • select: The function will write files equivalent to the original ones. Thus select = "*" and cannot be changed.

  • filter: Read only points of interest.

  • tree_detection
LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
las <- readLAS(LASfile, select = "xyz", filter = "-drop_z_below 0")

ttops <- tree_detection(las, lmf(ws = 5))

x = plot(las)
add_treetops3d(x, ttops)
# }
Documentation reproduced from package lidR, version 2.0.0, License: GPL-3

Community examples

Looks like there are no examples yet.