# NOT RUN {
LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
las = readLAS(LASfile, select = "xyz", filter = "-drop_z_below 0")
col = pastel.colors(200)
chm = grid_canopy(las, res = 0.5, subcircle = 0.3)
chm = as.raster(chm)
kernel = matrix(1,3,3)
chm = raster::focal(chm, w = kernel, fun = mean, na.rm = TRUE)
ttops = tree_detection(chm, 5, 2)
lastrees_dalponte(las, chm, ttops)
plot(las, color = "treeID", colorPalette = col)
# }
Run the code above in your browser using DataLab