40 #include <pcl/recognition/linemod.h>
41 #include <pcl/recognition/color_gradient_modality.h>
42 #include <pcl/recognition/surface_normal_modality.h>
43 #include <pcl/io/tar.h>
72 template <
typename Po
intXYZT,
typename Po
intRGBT=Po
intXYZT>
84 std::size_t template_id{0};
86 std::size_t object_id{0};
88 std::size_t detection_id{0};
99 : color_gradient_mod_ ()
100 , surface_normal_mod_ ()
122 loadTemplates (
const std::string &file_name, std::size_t object_id = 0);
133 linemod_.setDetectionThreshold (threshold);
143 color_gradient_mod_.setGradientMagnitudeThreshold (threshold);
156 intersection_volume_threshold_ = threshold;
167 surface_normal_mod_.setInputCloud (cloud);
168 surface_normal_mod_.processInputData ();
179 color_gradient_mod_.setInputCloud (cloud);
180 color_gradient_mod_.processInputData ();
191 createAndAddTemplate (
193 const std::size_t object_id,
210 float min_scale = 0.6944444f,
211 float max_scale = 1.44f,
212 float scale_multiplier = 1.2f);
221 computeTransformedTemplatePoints (
const std::size_t detection_id,
228 inline std::vector<std::size_t>
231 if (detection_id >= detections_.size ())
232 PCL_ERROR (
"ERROR pcl::LineRGBD::computeTransformedTemplatePoints - detection_id is out of bounds\n");
236 std::vector<std::size_t> vec;
247 inline std::vector<std::size_t>
250 if (detection_id >= detections_.size ())
251 PCL_ERROR (
"ERROR pcl::LineRGBD::computeTransformedTemplatePoints - detection_id is out of bounds\n");
255 std::vector<std::size_t> vec;
261 refineDetectionsAlongDepth ();
265 applyProjectiveDepthICPOnDetections ();
269 removeOverlappingDetections ();
284 float intersection_volume_threshold_{1.0f};
306 std::vector<typename pcl::LineRGBD<PointXYZT, PointRGBT>::Detection>
detections_;
311 #include <pcl/recognition/impl/linemod/line_rgbd.hpp>
Modality based on max-RGB gradients.
Template matching using the LINEMOD approach.
High-level class for template matching using the LINEMOD approach based on RGB and Depth data.
void setDetectionThreshold(float threshold)
Sets the threshold for the detection responses.
pcl::PointCloud< PointXYZT >::ConstPtr cloud_xyz_
XYZ point cloud.
pcl::LINEMOD linemod_
LINEMOD instance.
pcl::PointCloud< PointRGBT >::ConstPtr cloud_rgb_
RGB point cloud.
std::vector< typename pcl::LineRGBD< PointXYZT, PointRGBT >::Detection > detections_
Detections from last call of method detect (...).
void setGradientMagnitudeThreshold(const float threshold)
Sets the threshold on the magnitude of color gradients.
std::vector< std::size_t > findObjectPointIndices(const std::size_t detection_id)
Finds the indices of the points in the input cloud which correspond to the specified detection.
std::vector< pcl::BoundingBoxXYZ > bounding_boxes_
Bounding boxes corresponding to the templates.
std::vector< std::size_t > object_ids_
Object IDs corresponding to the templates.
pcl::ColorGradientModality< PointRGBT > color_gradient_mod_
Color gradient modality.
pcl::SurfaceNormalModality< PointXYZT > surface_normal_mod_
Surface normal modality.
std::vector< std::size_t > alignTemplatePoints(const std::size_t detection_id)
Aligns the template points with the points found at the detection position of the specified detection...
virtual ~LineRGBD()=default
Destructor.
pcl::PointCloud< pcl::PointXYZRGBA >::CloudVectorType template_point_clouds_
Point clouds corresponding to the templates.
void setIntersectionVolumeThreshold(const float threshold=1.0f)
Sets the threshold for the decision whether two detections of the same template are merged or not.
void setInputColors(const typename pcl::PointCloud< PointRGBT >::ConstPtr &cloud)
Sets the input cloud with rgb values.
void setInputCloud(const typename pcl::PointCloud< PointXYZT >::ConstPtr &cloud)
Sets the input cloud with xyz point coordinates.
std::vector< PointCloud< PointT >, Eigen::aligned_allocator< PointCloud< PointT > > > CloudVectorType
shared_ptr< const PointCloud< PointT > > ConstPtr
float width
Width of the bounding box.
float x
X-coordinate of the upper left front point.
float y
Y-coordinate of the upper left front point.
float depth
Depth of the bounding box.
float z
Z-coordinate of the upper left front point.
BoundingBoxXYZ()=default
Constructor.
float height
Height of the bounding box.
BoundingBoxXYZ bounding_box
The 3D bounding box of the detection.
Detection()=default
Constructor.
RegionXY region
The 2D template region of the detection.
Defines a region in XY-space.
A multi-modality template constructed from a set of quantized multi-modality features.