# NOT RUN {
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
las = readLAS(LASfile)
# Cloud of points is voxelized with a 3-meter resolution and in each voxel
# the number of points is computed.
voxel_metrics(las, ~length(Z), 3)
# Cloud of points is voxelized with a 3-meter resolution and in each voxel
# the mean scan angle of points is computed.
voxel_metrics(las, ~mean(Intensity), 3)
# }
# NOT RUN {
# Define your own metric function
myMetrics = function(i)
{
ret = list(
npoints = length(i),
imean = mean(i)
)
return(ret)
}
voxels = voxel_metrics(las, ~myMetrics(Intensity), 3)
plot(voxels, color = "imean", trim = 100)
#etc.
# }
Run the code above in your browser using DataLab