distance_clustering: Clustering of non connected objects in a point cloud.

Description Usage Arguments Details Value References Examples

View source: R/cluster_substract_V2.R View source: R/cluster_substract.R

Description

Clustering objects with non common points: two points located within a user defined distance from each other are considered as the parts of a unique object. This function is well suited to be applied to the outputs of the substract_point_clouds function.

Clustering objects with non common points: two points located within a user defined distance from each other are considered as the parts of a unique object. This function is well suited to be applied to the outputs of the substract_point_clouds function.

Usage

1
2
3
distance_clustering(data, d_clust, method, C_size, message)

distance_clustering(data, d_clust, method, C_size, message)

Arguments

data

a data.frame or data.table containing the x, y, z, ... coordinates of a point cloud or voxel cloud.

d_clust

numeric. The distance required to consider two points as being part of two different clusters. Default = 0.02.

method

character. The algorithm to use for clustering. Can be either "D_mat" or "Iter", see details. Default = "D_mat".

C_size

(optional) numeric. If method = "Iter", sets the maximal size of a cluster (in distance unit).

message

logical. If FALSE, messages are disabled. Default = TRUE.

Details

If method == "D_mat" the clustering process is based on building a matrix distance. This is time efficient but use a lot of memory. If method == "Iter" a slower but memory efficient iterative process is used. In some cases, D_clust can help to speed up the process.

Value

The input data with an additionnal field containing the cluster ID.

The input data with an additionnal field containing the cluster ID.

References

Lecigne, B., Delagrange, S., & Messier, C. (2018). Exploring trees in three dimensions: VoxR, a novel voxel-based R package dedicated to analysing the complex arrangement of tree crowns. Annals of botany, 121(4), 589-601.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#- import datasets
t0=data.table::fread(system.file("extdata", "Tree_t0.asc", package="VoxR"))
t1=data.table::fread(system.file("extdata", "Tree_t1.asc", package="VoxR"))

#- keep only the tree crown
t0 = t0[z>=0,]
t1 = t1[z>=0,]

#- substract t0 to t1 with the hull method
diff = VoxR::substract_point_clouds(t0 = t0,t1 = t1, method = "hull")

#- clustering the difference between t0 and t1
clust = VoxR::distance_clustering(diff,d_clust = 0.03)

#- plot the result (NOTE that colors are redundant)
rgl::open3d()
rgl::plot3d(clust,col=clust$cluster,add=TRUE)
#- import datasets
t0=data.table::fread(system.file("extdata", "Tree_t0.asc", package="VoxR"))
t1=data.table::fread(system.file("extdata", "Tree_t1.asc", package="VoxR"))

#- keep only the tree crown
t0 = t0[z>=0,]
t1 = t1[z>=0,]

#- substract t0 to t1 with the hull method
diff = VoxR::substract_point_clouds(t0 = t0,t1 = t1, method = "hull")

#- clustering the difference between t0 and t1 with the matrix distance based method
clust = VoxR::distance_clustering(diff,d_clust = 0.03)

#- plot the result (NOTE that colors are redundant)
rgl::open3d()
rgl::plot3d(clust,col=clust$cluster,add=TRUE)

#- clustering the difference between t0 and t1 with the iterative method
clust = VoxR::distance_clustering(diff,d_clust = 0.03,method = "Iter")

#- plot the result (NOTE that colors are redundant)
rgl::open3d()
rgl::plot3d(clust,col=clust$cluster,add=TRUE)

#- clustering the difference between t0 and t1 with the iterative method with maximum object size
clust = VoxR::distance_clustering(diff,d_clust = 0.03,method = "Iter",C_size = 1)

#- plot the result (NOTE that colors are redundant)
rgl::open3d()
rgl::plot3d(clust,col=clust$cluster,add=TRUE)

VoxR documentation built on Nov. 16, 2020, 9:14 a.m.