Filtering of point clouds using different methods

filter(
  cloud,
  method,
  radius,
  min_neighbours,
  k,
  nSigma,
  edge_length,
  distance = "euclidean",
  threads = 1L,
  verbose = FALSE,
  progress = FALSE,
  ...
)

Arguments

cloud

A data.table contain three columns representing the *XYZ* coordinates.

method

A filtering method to use. It most be "SOR", "min_neighbors", or "min_neighbors".

radius

A numeric vector representing the radius of the sphere to consider. This needs to be used if method = "voxel_center".

min_neighbours

An integer representing the minimum number of neighbors to keep a given point. This needs to be used if method = "min_n".

k

An integer vector representing the number of neighbors to consider. This needs be used if method = "SOR".

nSigma

A numeric vector representing the standard deviation multiplier. This needs to be used if method = "SOR".

edge_length

A positive numeric vector with the voxel-edge length for the x, y, and z coordinates. This needs to be used if method = "voxel_center".

distance

Type of distance to calculate. "euclidean" as default. Look hnsw_knn for more options.

threads

An integer specifying the number of threads to use for parallel processing. Experiment to see what works best for your data on your hardware.

verbose

If TRUE, log messages to the console.

progress

If TRUE, log a progress bar when verbose = TRUE. Tracking progress could cause a small overhead.

...

Arguments passed to hnsw_build and hnsw_search.

Value

A data.table with the filtered points

Author

J. Antonio Guzmán Q.

Examples


# \donttest{
#Load data
data("pc_tree")

#Move pc_tree for comparison
pc_compare <- pc_tree
pc_compare$X <- pc_compare$X - 7

#SOR filter
r1 <- filter(pc_tree, method = "SOR", k = 30, nSigma = 1)
rgl::plot3d(r1, col = "red") #Filter
#> Warning: font family "sans" not found, using "bitmap"
rgl::points3d(pc_compare, col = "black") #Original
#min_neighbours filter r2 <- filter(pc_tree, "min_neighbors", radius = 0.02, min_neighbours = 20) rgl::plot3d(r2, col = "red") #Filter rgl::points3d(pc_compare, col = "black") #Original
#voxel_center filter r3 <- filter(pc_tree, method = "voxel_center", edge_length = 0.1) rgl::plot3d(r3, col = "red") #Filter rgl::points3d(pc_compare, col = "black") #Original
# }