Learn R Programming

rTLS (version 0.2.3)

filter: Filtering of Point Clouds

Description

Filtering of point clouds using different methods

Usage

filter(
  cloud,
  method,
  radius,
  min_neighbours,
  k,
  nSigma,
  edge_length,
  build = "kdtree",
  threads = 1L,
  checks = 20
)

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".

build

A character describing the search structure to be used: "kdtree", "kmeans", "linear". Default "kdtree".

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.

checks

Number of checks during searching. Higher value gives better search precision but takes longer. checks = 20 as default.

Value

A data.table with the filtered points

Examples

Run this code
# NOT RUN {
#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
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

# }

Run the code above in your browser using DataLab