MCPcopy Create free account
hub / github.com/Pamphlett/Outram / labelAnalysis

Method labelAnalysis

include/cluster_manager.hpp:753–780  ·  view source on GitHub ↗

* @brief delete clusters with fewer points, store clusters into a vector of * point clouds * @param label_info, input category information * @return void */

Source from the content-addressed store, hash-verified

751 * @return void
752 */
753 void labelAnalysis(std::vector<int>& label_info) {
754 std::unordered_map<int, std::vector<int>> label2segIndex;
755 size_t totalSize = label_info.size();
756 for (size_t i = 0; i < totalSize; ++i) {
757 // zero initialization for unordered_map
758 label2segIndex[label_info[i]].emplace_back(i);
759 // if (label2segIndex.find(label_info[i]) == label2segIndex.end()) {
760 // label2segIndex[label_info[i]].emplace_back(i);
761 // }
762 // else {
763 // label2segIndex[label_info[i]] += 1;
764 // }
765 }
766
767 for (auto& it : label2segIndex) {
768 if (it.second.size() >= params_.minSeg) {
769 pcl::PointCloud<PointType>::Ptr cur_cloud(
770 new pcl::PointCloud<PointType>);
771 for (auto& idx : it.second) {
772 // cur_cloud->points.emplace_back(selected_points_->points[idx]);
773 cur_cloud->points.push_back(selected_points_->points[idx]);
774 }
775 clusters_.push_back(cur_cloud);
776 }
777 }
778 // free memory
779 std::unordered_map<int, std::vector<int>>().swap(label2segIndex);
780 }
781
782 void setParams(int semantic_class,
783 double cluster_distance_threshold,

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected