knn_distance {lidR} | R Documentation |
Computes the Distance to k-Nearest Neighbors
Description
Computes the average distance between each point and its k-nearest neighbors in a point cloud. The results are stored in a new attribute.
Usage
knn_distance(las, k = 10, name = "distance")
Arguments
las |
A LAS object representing the point cloud data. |
k |
The number of nearest neighbors. |
name |
A string specifying the name of the new attribute used to store the computed distances. |
Value
A LAS object with an additional attribute named as specified by 'name'.
Examples
LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
las <- readLAS(LASfile, select = "xyz", filter = "-inside 481250 3812980 481300 3813030")
las = knn_distance(las)
#plot(las, color = "distance", breaks = "quantile", legend = TRUE)
[Package lidR version 4.2.1 Index]