This function is made to be used in classify_noise . It implements an algorithm for outliers (noise) segmentation based on Statistical Outliers Removal (SOR) methods first described in the PCL library and also implemented in CloudCompare (see references). For each point, it computes the mean distance to all its k-nearest neighbours. The points that are farther than the average distance plus a number of times (multiplier) the standard deviation are considered noise.
sor(k =10, m =3, quantile =FALSE)
Arguments
k: numeric. The number of neighbours
m: numeric. Multiplier. The maximum distance will be: avg distance + m * std deviation. If quantile = TRUE, m becomes the quantile threshold.
quantile: boolean. Modification of the original SOR to use a quantile threshold instead of a standard deviation multiplier. In this case the maximum distance will be: quantile(distances, probs = m)
Examples
LASfile <- system.file("extdata","Topography.laz", package="lidR")las <- readLAS(LASfile, filter ="-inside 273450 5274350 273550 5274450")# Add some artificial outliers because the original# dataset is 'clean'set.seed(314)id = round(runif(20,0, npoints(las)))set.seed(42)err = runif(20,-50,50)las$Z[id]= las$Z[id]+ err
las <- classify_noise(las, sor(15,7))