7 #include <pcl/point_cloud.h>
8 #include <pcl/point_types.h>
9 #include <pcl/PointIndices.h>
11 #include <SemanticObjectRelations/Shapes/shape_containers.h>
12 #include <SemanticObjectRelations/Shapes/AxisAlignedBoundingBox.h>
14 #include <SimoxUtility/math/SoftMinMax.h>
15 #include <SimoxUtility/shapes/AxisAlignedBoundingBox.h>
24 semrel::ShapeList
getShapesFromAABBs(
const pcl::PointCloud<pcl::PointXYZL>& pointCloud);
26 semrel::ShapeList
getShapesFromAABBs(
const pcl::PointCloud<pcl::PointXYZRGBL>& pointCloud);
36 semrel::ShapeList
getShapesFromAABBs(
const std::map<uint32_t, semrel::AxisAlignedBoundingBox>& segmentAABBs);
40 template <
class Po
intT,
class IndicesT = pcl::Po
intIndices>
42 getAABB(
const pcl::PointCloud<PointT>& pointCloud,
const IndicesT& segmentIndices);
48 template <
class Po
intT,
class IndicesT = pcl::Po
intIndices>
49 std::map<uint32_t, semrel::AxisAlignedBoundingBox>
50 getAABBs(
const pcl::PointCloud<PointT>& pointCloud,
51 const std::map<uint32_t, IndicesT>& segmentIndices);
58 template <
class Po
intT>
60 getSoftAABB(
const pcl::PointCloud<PointT>& pointCloud,
const pcl::PointIndices& segmentIndices,
67 template <
class Po
intT>
68 std::map<uint32_t, semrel::AxisAlignedBoundingBox>
70 const std::map<uint32_t, pcl::PointIndices>& segmentIndices,
83 template <
class Po
intT,
class IndicesT>
90 template <
class Po
intT,
class IndicesT>
92 const pcl::PointCloud<PointT>& pointCloud,
const std::map<uint32_t, IndicesT>& segmentIndices)
94 std::map<uint32_t, semrel::AxisAlignedBoundingBox> aabbs;
104 template <
class Po
intT>
107 const pcl::PointIndices&
indices,
float outlierRatio)
112 simox::math::SoftMinMax minMaxX(outlierRatio,
indices.indices.size());
113 simox::math::SoftMinMax minMaxY(outlierRatio,
indices.indices.size());
114 simox::math::SoftMinMax minMaxZ(outlierRatio,
indices.indices.size());
118 const PointT& point = pointCloud[
static_cast<std::size_t
>(
index)];
120 minMaxX.add(point.x);
121 minMaxY.add(point.y);
122 minMaxZ.add(point.z);
126 aabb.minX() = minMaxX.getSoftMin();
127 aabb.maxX() = minMaxX.getSoftMax();
128 aabb.minY() = minMaxY.getSoftMin();
129 aabb.maxY() = minMaxY.getSoftMax();
130 aabb.minZ() = minMaxZ.getSoftMin();
131 aabb.maxZ() = minMaxZ.getSoftMax();
137 template <
class Po
intT>
138 std::map<uint32_t, semrel::AxisAlignedBoundingBox>
140 const std::map<uint32_t, pcl::PointIndices>& segmentIndices,
143 std::map<uint32_t, semrel::AxisAlignedBoundingBox> segmentAABBs;
144 for (
const auto& [label,
indices] : segmentIndices)