Learn R Programming

lidR (version 2.0.0)

tree_detection: Individual tree detection

Description

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

Usage

tree_detection(las, algorithm)

Arguments

las

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.

algorithm

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

Value

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.

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab