Learn R Programming

CspStandSegmentation (version 0.1.2)

forest_inventory: Function to perform a forest inventory based on a segmented las object (needs to contain TreeID)

Description

This function estimates a taper curve for evry tree and returns the DBH at 1.3m, its position in XY coordinates, the tree height and the trees 2D projection area.

Usage

forest_inventory(
  las,
  slice_min = 0.3,
  slice_max = 4,
  increment = 0.2,
  width = 0.1,
  max_dbh = 1,
  n_cores = max(c(1, parallel::detectCores()/2 - 1))
)

Value

a data.frame with the TreeID, X, Y, DBH, quality_flag, Height and ConvexHullArea

Arguments

las

lidR las object with the segmented trees

slice_min

the minimum height of a slice for stems to estimate the taper curve

slice_max

the maximum height of a slice for stems to estimate the taper curve

increment

the increment of the slices

width

the width of the slices

max_dbh

the maximum DBH allowed

n_cores

number of cores to use

Examples

Run this code
# \donttest{
# read example data
file = system.file("extdata", "beech.las", package="CspStandSegmentation")
las = lidR::readTLSLAS(file)

# find tree positions as starting points for segmentation
map <- CspStandSegmentation::find_base_coordinates_raster(las)

# segment trees
segmented <- las |>
  CspStandSegmentation::add_geometry(n_cores = 2) |>
  CspStandSegmentation::csp_cost_segmentation(map, 1, N_cores = 2)

# perform inventory
inventory <- CspStandSegmentation::forest_inventory(segmented, n_cores = 2)
# }

Run the code above in your browser using DataLab