| 13 | Instance::Instance() { tree_id_ = 0; } |
| 14 | |
| 15 | void Instance::findClusters(const CloudT::Ptr pc, |
| 16 | pcl::PointCloud<pcl::Label>& euclidean_labels, std::vector<pcl::PointIndices>& label_indices){ |
| 17 | if(pc->size() == 0) return; |
| 18 | |
| 19 | pcl::EuclideanClusterComparator<PointT, pcl::Label>::Ptr |
| 20 | euclidean_cluster_comparator(new pcl::EuclideanClusterComparator<PointT, pcl::Label>()); |
| 21 | |
| 22 | euclidean_cluster_comparator->setInputCloud(pc); |
| 23 | euclidean_cluster_comparator->setDistanceThreshold(1.0, false); |
| 24 | |
| 25 | pcl::OrganizedConnectedComponentSegmentation<PointT, pcl::Label> |
| 26 | euclidean_segmentation(euclidean_cluster_comparator); |
| 27 | euclidean_segmentation.setInputCloud(pc); |
| 28 | euclidean_segmentation.segment(euclidean_labels, label_indices); |
| 29 | |
| 30 | // pcl::PCDWriter writer; |
| 31 | // for (size_t i = 0; i < label_indices.size (); i++){ |
| 32 | // // std::cout << "LABEL INDICES SIZE: " << label_indices.at(i).indices.size() << std::endl; |
| 33 | // if (label_indices.at(i).indices.size () > 80){ |
| 34 | // CloudT cluster; |
| 35 | // pcl::copyPointCloud(*pc, label_indices.at(i).indices, cluster); |
| 36 | // ROS_DEBUG_STREAM(cluster.width << " x " << cluster.height); |
| 37 | // // clusters.push_back(cluster); |
| 38 | // std::stringstream ss; |
| 39 | // ss << "/opt/bags/inf/pcds/sloam/" << "cloud_cluster_" << i << ".pcd"; |
| 40 | // writer.write<PointT> (ss.str (), cluster, false); |
| 41 | // } |
| 42 | // } |
| 43 | } |
| 44 | |
| 45 | TreeVertex Instance::computeTreeVertex(CloudT::Ptr beam, int label){ |
| 46 | TreeVertex v; |
nothing calls this directly
no outgoing calls
no test coverage detected