14 #include <mrpt/containers/yaml.h> 15 #include <mrpt/maps/CSimplePointsMap.h> 16 #include <mrpt/math/ops_containers.h> 17 #include <mrpt/obs/CObservation2DRangeScan.h> 18 #include <mrpt/random/RandomGenerators.h> 26 const mrpt::containers::yaml& c)
33 c.has(
"bounding_box_min") && c[
"bounding_box_min"].isSequence() &&
34 c[
"bounding_box_min"].asSequence().size() == 3);
36 c.has(
"bounding_box_max") && c[
"bounding_box_max"].isSequence() &&
37 c[
"bounding_box_max"].asSequence().size() == 3);
39 const auto bboxMin = c[
"bounding_box_min"].toStdVector<
double>();
40 const auto bboxMax = c[
"bounding_box_max"].toStdVector<
double>();
42 for (
int i = 0; i < 3; i++)
55 MRPT_LOG_DEBUG_STREAM(
"Loading these params:\n" << c);
69 "Input point cloud layer '%s' was not found.",
72 const auto& pc = *pcPtr;
78 mrpt::maps::CPointsMap::Ptr outPc;
80 itLy != inOut.
layers.end())
82 outPc = std::dynamic_pointer_cast<mrpt::maps::CPointsMap>(itLy->second);
85 "Layer '%s' must be of point cloud type.",
90 outPc = mrpt::maps::CSimplePointsMap::Create();
94 outPc->reserve(outPc->size() + pc.size() / 10);
96 const auto& xs = pc.getPointsBufferRef_x();
97 const auto& ys = pc.getPointsBufferRef_y();
98 const auto& zs = pc.getPointsBufferRef_z();
100 for (
size_t i = 0; i < xs.size(); i++)
102 const bool isInside =
110 outPc->insertPointFast(xs[i], ys[i], zs[i]);
std::map< layer_name_t, mrpt::maps::CMetricMap::Ptr > layers
Generic container of pointcloud(s), extracted features and other maps.
std::string input_pointcloud_layer
IMPLEMENTS_MRPT_OBJECT(FilterBoundingBox, mp2p_icp_filters::FilterBase, mp2p_icp_filters) using namespace mp2p_icp_filters
void load_from_yaml(const mrpt::containers::yaml &c)
Leaves or removes the points in a given bounding box.
mrpt::math::TBoundingBoxf bounding_box
void initialize(const mrpt::containers::yaml &c) override
void filter(mp2p_icp::metric_map_t &inOut) const override
mrpt::maps::CPointsMap::Ptr point_layer(const layer_name_t &name) const
std::string output_pointcloud_layer