# NOT RUN {
LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
poi <- "-drop_z_below 0 -inside 481280 3812940 481320 3812980"
las <- readLAS(LASfile, select = "xyz", filter = poi)
col <- pastel.colors(200)
chm <- grid_canopy(las, res = 0.5, p2r(0.3))
ker <- matrix(1,3,3)
chm <- raster::focal(chm, w = ker, fun = mean, na.rm = TRUE)
ttops <- find_trees(chm, lmf(4, 2))
las <- segment_trees(las, silva2016(chm, ttops))
#plot(las, color = "treeID", colorPalette = col)
# }
Run the code above in your browser using DataLab