MCPcopy Create free account
hub / github.com/KumarRobotics/sloam / findClusters

Function findClusters

sloam/src/segmentation/test_inference.cpp:16–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14using CloudT = pcl::PointCloud<PointT>;
15
16void findClusters(const CloudT::Ptr pc){
17 pcl::PointCloud<pcl::Label> euclidean_labels;
18 std::vector<pcl::PointIndices> label_indices;
19
20 pcl::EuclideanClusterComparator<PointT, pcl::Label>::Ptr
21 euclidean_cluster_comparator(new pcl::EuclideanClusterComparator<PointT, pcl::Label>());
22
23 std::cout << pc->points.size() << std::endl;
24 std::cout << pc->width << std::endl;
25 std::cout << pc->height << std::endl;
26
27 euclidean_cluster_comparator->setInputCloud(pc);
28 euclidean_cluster_comparator->setDistanceThreshold(0.5, false);
29
30 pcl::OrganizedConnectedComponentSegmentation<PointT, pcl::Label>
31 euclidean_segmentation(euclidean_cluster_comparator);
32 euclidean_segmentation.setInputCloud(pc);
33 euclidean_segmentation.segment(euclidean_labels, label_indices);
34
35 pcl::PCDWriter writer;
36 std::cout << "NUM CLUSTERS: " << label_indices.size() << std::endl;
37 for (size_t i = 0; i < label_indices.size (); i++){
38 if (label_indices.at(i).indices.size () > 100){
39 std::cout << "LABEL INDICES SIZE: " << label_indices.at(i).indices.size() << std::endl;
40
41 CloudT cluster;
42 pcl::copyPointCloud(*pc, label_indices.at(i).indices, cluster);
43 // clusters.push_back(cluster);
44 std::stringstream ss;
45 ss << "/opt/bags/inf/pcds/realcc/" << "cloud_cluster_" << i << ".pcd";
46 writer.write<PointT> (ss.str (), cluster, false);
47 }
48 }
49
50}
51
52int main(int argc, char* argv[])
53{

Callers 2

computeGraphMethod · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected