wang_clustering: Implement the graph based segmentation presented in Wang et...

View source: R/wang_clustering.R

wang_clusteringR Documentation

Implement the graph based segmentation presented in Wang et al.

Description

Implement the graph based segmentation presented in Wang et al.

Usage

wang_clustering(
  las,
  graph,
  heigth_th_merge_roots = 0.5,
  distance_th_merge_close_roots = 1,
  merge_non_connected = TRUE
)

Arguments

las

a LAS file. NOTE: the data must be ordered similarly than when the graph was created.

graph

a graph produced with the knn_graph or delaunay_graph functions.

heigth_th_merge_roots

numeric. Defines the height of a root relative to the ground to be considered as valid.

distance_th_merge_close_roots

numeric. Defines the distance between two roots to be merged. It defines the euclidean distance threshold, the geodesic distance threshold = 3*distance_th_merge_close_roots as suggested by Wang et al.

merge_non_connected

logical. If TRUE objects that are disconnected in the graph are merged to the nearest cluster.

Value

the las file

References

Wang, D., Liang, X., Mofack, G. I., & Martin-Ducup, O. (2021). Individual tree extraction from terrestrial laser scanning data via graph pathing. Forest Ecosystems, 8(1), 1-11.

Examples


######################################
# Wang et al. tree segmentation method
######################################
# import data
file = system.file("extdata", "four_trees.las", package="lidUrb")
las = lidR::readLAS(file)

# reduce point density to 0.1 instead of voxelisation as in Wang et al.
las = lidUrb::reduce_point_density(las,0.1)

# build an hybrid graph mixing a knn graph and a dlaunay graph
# with Wang et al parameters
hybrid_graph = data.table::rbindlist(list(
  lidUrb::knn_graph(las,k=10L,local_filter = 1),
  lidUrb::delaunay_graph(las,global_filter = 0.8)
))

# run the downward clustering following the hybrid graph, parameters are
# guessed after Wang et al. paper
las_sub=lidUrb::wang_clustering(las=las,
                                graph=hybrid_graph,
                                heigth_th_merge_roots = 1,
                                distance_th_merge_close_roots = 1)

# plot the result
lidR::plot(las_sub,color="cluster_wang")

########################
# An alternative example
########################
# import data
file = system.file("extdata", "four_trees.las", package="lidUrb")
las = lidR::readLAS(file)

# reduce point density to 0.1 instead of voxelisation as in Wang et al.
las = lidUrb::reduce_point_density(las,0.1)

# build a knn graph
KNN = lidUrb::knn_graph(las,local_filter = 0.5)

# run the downward clustering following the hybrid graph, parameters are
# guessed after Wang et al. paper
las_sub=lidUrb::wang_clustering(las=las,
                                graph=KNN,
                                heigth_th_merge_roots = 1,
                                distance_th_merge_close_roots = 1)

# plot the result
lidR::plot(las_sub,color="cluster_wang")


Blecigne/lidUrb documentation built on Feb. 19, 2024, 9:12 a.m.