# NOT RUN {
LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
las = readLAS(LASfile, filter = "-drop_z_below 0")
# segment trees (see lastrees)
lastrees(las, algorithm = "li2012-2")
# Max height for each tree
tree_metrics(las, mean(Z))
# Define your own new metrics
myMetrics = function(z, i)
{
metrics = list(
imean = mean(i),
imax = max(i),
npoint = length(z)
)
return(metrics)
}
metrics = tree_metrics(las, myMetrics(Z, Intensity))
# predefined metrics (see ?stdmetrics)
metrics = tree_metrics(las, .stdtreemetrics)
# }
Run the code above in your browser using DataLab