View source: R/wang_clustering.R
wang_clustering | R Documentation |
Implement the graph based segmentation presented in Wang et al.
wang_clustering(
las,
graph,
heigth_th_merge_roots = 0.5,
distance_th_merge_close_roots = 1,
merge_non_connected = TRUE
)
las |
a LAS file. NOTE: the data must be ordered similarly than when the graph was created. |
graph |
a graph produced with the |
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. |
the las file
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.
######################################
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.