delineate_crowns: Compute the hull of each tree.

Description Usage Arguments Details Value Working with a LAScatalog Supported processing options References Examples

View source: R/delineate_crowns.R

Description

Compute the hull of each segmented tree. The hull can be convex, concave or a bounding box (see details and references).

Usage

1
2
3
4
5
6
7
8
delineate_crowns(
  las,
  type = c("convex", "concave", "bbox"),
  concavity = 3,
  length_threshold = 0,
  func = NULL,
  attribute = "treeID"
)

Arguments

las

An object of class LAS or LAScatalog.

type

character. Hull type. Can be 'convex', 'concave' or 'bbox'.

concavity

numeric. If type = "concave", a relative measure of concavity. 1 results in a relatively detailed shape, Infinity results in a convex hull.

length_threshold

numeric. If type = "concave", when a segment length is below this threshold, no further detail is added. Higher values result in simpler shapes.

func

formula. An expression to be applied to each tree. It works like in grid_metrics voxel_metrics or tree_metrics and computes, in addition to the hulls a set of metrics for each tree.

attribute

character. The attribute where the ID of each tree is stored. In lidR, the default is "treeID".

Details

The concave hull method under the hood is described in Park & Oh (2012). The function relies on the concaveman function.

Value

A SpatialPolygonsDataFrame. If a tree has less than 4 points it is not considered.

Working with a LAScatalog

This section appears in each function that supports a LAScatalog as input.

In lidR when the input of a function is a LAScatalog the function uses the LAScatalog processing engine. The user can modify the engine options using the available options. A careful reading of the engine documentation is recommended before processing LAScatalogs. Each lidR function should come with a section that documents the supported engine options.

The LAScatalog engine supports .lax files that significantly improve the computation speed of spatial queries using a spatial index. Users should really take advantage a .lax files, but this is not mandatory.

Supported processing options

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

References

Park, J. S., & Oh, S. J. (2012). A new concave hull algorithm and concaveness measure for n-dimensional datasets. Journal of Information science and engineering, 28(3), 587-600.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
poi = "-drop_z_below 0 -inside 481280 3812940 481320 3812980"
las = readLAS(LASfile, select = "xyz0", filter = poi)

# NOTE: This dataset is already segmented

#plot(las, color = "treeID", colorPalette = pastel.colors(200))

# Only the hulls
convex_hulls = delineate_crowns(las)
plot(convex_hulls)

# The hulls + some user-defined metrics
convex_hulls = delineate_crowns(las, func = ~list(Zmean = mean(Z)))
convex_hulls

# The bounding box
bbox_hulls = delineate_crowns(las, "bbox")
plot(bbox_hulls)

## Not run: 
# With concave hull (longer to compute)
concave_hulls = delineate_crowns(las, "concave")
plot(concave_hulls)

spplot(convex_hulls, "ZTOP")
spplot(convex_hulls, "Zmean")

## End(Not run)

Example output

Loading required package: raster
Loading required package: sp
class       : SpatialPolygonsDataFrame 
features    : 58 
extent      : 481280, 481320, 3812940, 3812980  (xmin, xmax, ymin, ymax)
crs         : +proj=utm +zone=12 +datum=NAD83 +units=m +no_defs 
variables   : 5
names       : treeID,      XTOP,       YTOP,  ZTOP,            Zmean 
min values  :     17, 481280.12, 3812940.02,  2.76,             0.99 
max values  :    187, 481319.97, 3812979.91, 28.92, 21.0892972972973 
There were 50 or more warnings (use warnings() to see the first 50)
There were 50 or more warnings (use warnings() to see the first 50)

lidR documentation built on June 21, 2021, 5:07 p.m.