chullLiDAR2D {rLiDAR} | R Documentation |
Compute and plot the 2D convex hull of individual tree LiDAR-derived point cloud
chullLiDAR2D(xyid)
xyid |
A 3-column matrix with the x, y coordinates and points id of the LiDAR point cloud. |
Returns A list with components "chullPolygon" and "chullArea", giving the polygon and area of the convex hull.
Carlos Alberto Silva
grDevices package,see chull
.
# Importing LAS file: LASfile <- system.file("extdata", "LASexample1.las", package="rLiDAR") # Reading LAS file LAS<-readLAS(LASfile,short=TRUE) # Height subsetting the data xyz<-subset(LAS[,1:3],LAS[,3] >= 1.37) # Getting LiDAR clusters set.seed(1) clLAS<-kmeans(xyz, 32) # Set the points id id<-as.factor(clLAS$cluster) # Set the xyid input xyid<-cbind(xyz[,1:2],id) # Compute the LiDAR convex hull of the clusters chullTrees<-chullLiDAR2D(xyid) # Plotting the LiDAR convex hull library(sp) plot(SpatialPoints(xyid[,1:2]),cex=0.5,col=xyid[,3]) plot(chullTrees$chullPolygon,add=TRUE, border='green') # Get the ground-projected area of LiDAR convex hull chullList<-chullTrees$chullArea summary(chullList) # summary