In the PCL tutorial, we can learn how to segment a plane and extract the Euclidean cluster point clouds. So now, after I used the pcl::EuclideanClusterExtraction
algorithm. I need the centroid or the mean position of each cluster.
Using pcl::EuclideanClusterExtraction
I need to calculate the centroid with the for loops. After my search I found out the pcl::Kmeans
which provides directly a function get_centroids()
to get the centroids of the clusters: https://pointclouds.org/documentation/classpcl_1_1_kmeans.html#a8788bd4098ea370e018119fc516a5eb4
Now, I'm a little bit confused. What is the real application different between pcl::EuclideanClusterExtraction
and pcl::Kmeans
? After analysing the source code, pcl::EuclideanClusterExtraction
provides us clusters based on three parameters. pcl::Kmeans
is used if we determine how many clusters we want to generate, because of the arguments in the constructor Kmeans (unsigned int num_points, unsigned int num_dimensions)
.
Is that true? Is there any other cases?
These are two very different algorithms:
cluster extraction with tolerance larger than distance among blue/black dots, but smaller than distance between black and blue dots: