25 #include <pcl/common/io.h>
40 pcl::PointCloud<PointL>::ConstPtr inputCloud,
44 ARMARX_CHECK(inputCloud) <<
"Passed input cloud must not be null (name: " << name <<
").";
48 inputLabeledClouds[name] = inputCloud;
53 pcl::PointCloud<PointT>::Ptr unlabeled(
new pcl::PointCloud<PointT>);
54 pcl::copyPointCloud(*inputCloud, *unlabeled);
61 pcl::PointCloud<PointL>::ConstPtr inputCloud,
62 visionx::PointContentType originalType)
69 pcl::PointCloud<PointT>::ConstPtr inputCloud)
72 ARMARX_CHECK(inputCloud) <<
"Passed input cloud must not be null (name: " << name <<
").";
74 inputUnlabeledClouds[name] = inputCloud;
77 inputLabeledClouds.erase(name);
87 if (!inputUnlabeledClouds.empty())
90 labelUnlabeledClouds(getUsedLabels());
101 MergedLabeledPointCloud::getUsedLabels() const ->
std::
set<
Label>
104 std::set<Label> usedLabels;
105 for (
const auto& [name, cloud] : inputLabeledClouds)
107 for (
const auto& point : cloud->points)
109 usedLabels.insert(point.label);
116 MergedLabeledPointCloud::labelUnlabeledClouds(
const std::set<Label>& usedLabels)
120 for (
const auto& [name, unlabeled] : inputUnlabeledClouds)
123 while (usedLabels.count(label) > 0)
129 pcl::PointCloud<PointL>::Ptr labeled(
new pcl::PointCloud<PointL>);
130 pcl::copyPointCloud(*unlabeled, *labeled);
131 for (
auto& point : labeled->points)
137 inputLabeledClouds[name] = labeled;
140 inputUnlabeledClouds.clear();
144 MergedLabeledPointCloud::mergeLabeledClouds()
147 resultCloud->clear();
149 for (
const auto& [name, cloud] : inputLabeledClouds)
154 (*resultCloud) += *cloud;