crop.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <Eigen/Core>
4
5
#include <pcl/point_cloud.h>
6
#include <pcl/PointIndices.h>
7
#include <pcl/common/io.h>
8
9
#include <SimoxUtility/shapes/AxisAlignedBoundingBox.h>
10
11
12
namespace
visionx::tools
13
{
14
15
template
<
typename
Po
int
CloudT>
16
pcl::PointIndices::Ptr
getCropIndices
(
const
PointCloudT
& inputCloud,
17
Eigen::Vector3f
min
, Eigen::Vector3f
max
)
18
{
19
using
PointT
=
typename
PointCloudT::PointType
;
20
21
const
simox::AxisAlignedBoundingBox
aabb(
min
,
max
);
22
pcl::PointIndices::Ptr
indices
(
new
pcl::PointIndices);
23
for
(
size_t
i = 0; i < inputCloud.size(); ++i)
24
{
25
const
PointT
& p = inputCloud[i];
26
if
(aabb.is_inside(p))
27
{
28
indices
->indices.push_back(
int
(i));
29
}
30
}
31
return
indices
;
32
}
33
34
template
<
typename
Po
int
CloudT>
35
typename
PointCloudT::Ptr
36
getCropped
(
const
PointCloudT
& inputCloud,
37
Eigen::Vector3f
min
, Eigen::Vector3f
max
)
38
{
39
pcl::PointIndices::Ptr
indices
=
getCropIndices
(inputCloud,
min
,
max
);
40
41
typename
PointCloudT::Ptr result(
new
PointCloudT
);
42
pcl::copyPointCloud(inputCloud, *
indices
, *result);
43
44
return
result;
45
}
46
47
}
visionx::tools
Definition:
PCLUtilities.cpp:4
visionx::armem::pointcloud::PointType
PointType
Definition:
constants.h:78
armarx::aron::simox::arondto::AxisAlignedBoundingBox
::simox::arondto::AxisAlignedBoundingBox AxisAlignedBoundingBox
Definition:
simox.h:14
visionx::tools::getCropIndices
pcl::PointIndices::Ptr getCropIndices(const PointCloudT &inputCloud, Eigen::Vector3f min, Eigen::Vector3f max)
Definition:
crop.h:16
pcl::graph::indices
pcl::PointIndices::Ptr indices(const PCG &g)
Retrieve the indices of the points of the point cloud stored in a point cloud graph that actually bel...
Definition:
point_cloud_graph.h:737
max
T max(T t1, T t2)
Definition:
gdiam.h:48
armarx::PointCloudT
pcl::PointCloud< PointT > PointCloudT
Definition:
Common.h:30
visionx::tools::getCropped
PointCloudT::Ptr getCropped(const PointCloudT &inputCloud, Eigen::Vector3f min, Eigen::Vector3f max)
Definition:
crop.h:36
min
T min(T t1, T t2)
Definition:
gdiam.h:42
visionx::PointT
pcl::PointXYZRGBA PointT
Definition:
MaskRCNNPointCloudObjectLocalizer.h:79
VisionX
libraries
PointCloudTools
crop.h
Generated on Sat Oct 12 2024 09:14:18 for armarx_documentation by
1.8.17