highly_connected_graph: Transform a graph into a highly connected graph, i.e. a graph...

View source: R/highly_connected_graph.R

highly_connected_graphR Documentation

Transform a graph into a highly connected graph, i.e. a graph with nearly all points belonging to a cluster that have a minimum Z value lower than a given threshold

Description

Transform a graph into a highly connected graph, i.e. a graph with nearly all points belonging to a cluster that have a minimum Z value lower than a given threshold

Usage

highly_connected_graph(las, graph, min_Z_th = 1, max_edge_length = 0.5)

Arguments

las

a LAS file.

graph

a graph as created by the knn_graph or delaunay_graph

min_Z_th

numeric. The value of Z to decide if a cluster is valid or not.

max_edge_length

numeric. The maximum edge length that can be added to the graph.

Value

a highly connected grapg

Examples


# import data
file = system.file("extdata", "four_trees.las", package="lidUrb")
las = lidR::readLAS(file,select = "xyz")

# 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)

# graph clustering without highly connected graph
las = lidUrb::graph_clustering(las,KNN)
# random colors to plot not highly connected clusters
las@data[,plot_not_high := sample(1:10,1),by = cluster_graph]

# transform graph into a highly connected graph
KNN = lidUrb::highly_connected_graph(las=las,graph = KNN)
# graph clustering based on the highly connected graph
las = lidUrb::graph_clustering(las,KNN)
las@data[,plot_high := sample(1:10,1),by = cluster_graph]

# plot the result
lidR::plot(las,color="plot_not_high")
lidR::plot(las,color="plot_high")


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