Learn R Programming

lidR (version 1.6.1)

tree_hulls: Compute the hull of each tree.

Description

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

Usage

tree_hulls(las, type = c("convex", "concave", "bbox"), concavity = 3,
  length_threshold = 0, field = "treeID")

Arguments

las

An object of class LAS.

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.

field

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

Value

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

Details

The concave hull method under the hood is described in Park & Oh (2012). The function relies on the concaveman function which itself is a wrapper around Vladimir Agafonking's implementation.

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

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

lastrees_li2(las, speed_up = 7)

convex_hulls = tree_hulls(las)
sp::plot(convex_hulls)

bbox_hulls = tree_hulls(las, "bbox")
sp::plot(bbox_hulls)

# }
# NOT RUN {
concave_hulls = tree_hulls(las, "concave")
sp::plot(concave_hulls)
# }

Run the code above in your browser using DataLab