Point Cloud Library (PCL)  1.14.1-dev
hough_3d.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2012, Willow Garage, Inc.
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of Willow Garage, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  * $Id:$
37  *
38  */
39 
40 #pragma once
41 
42 #include <pcl/recognition/cg/correspondence_grouping.h>
43 #include <pcl/memory.h>
44 #include <pcl/pcl_macros.h>
45 #include <pcl/point_types.h>
46 
47 #include <unordered_map>
48 
49 namespace pcl
50 {
51  namespace recognition
52  {
53  /** \brief HoughSpace3D is a 3D voting space. Cast votes can be interpolated in order to better deal with approximations introduced by bin quantization. A weight can also be associated with each vote.
54  * \author Federico Tombari (original), Tommaso Cavallari (PCL port)
55  * \ingroup recognition
56  */
58  {
59 
60  public:
62 
63  using Ptr = shared_ptr<HoughSpace3D>;
64  using ConstPtr = shared_ptr<const HoughSpace3D>;
65 
66  /** \brief Constructor
67  *
68  * \param[in] min_coord minimum (x,y,z) coordinates of the Hough space
69  * \param[in] bin_size size of each bing of the Hough space.
70  * \param[in] max_coord maximum (x,y,z) coordinates of the Hough space.
71  */
72  HoughSpace3D (const Eigen::Vector3d &min_coord, const Eigen::Vector3d &bin_size, const Eigen::Vector3d &max_coord);
73 
74  /** \brief Reset all cast votes. */
75  void
76  reset ();
77 
78  /** \brief Casting a vote for a given position in the Hough space.
79  *
80  * \param[in] single_vote_coord coordinates of the vote being cast (in absolute coordinates)
81  * \param[in] weight weight associated with the vote.
82  * \param[in] voter_id the numeric id of the voter. Useful to trace back the voting correspondence, if the vote is returned by findMaxima as part of a maximum of the Hough Space.
83  * \return the index of the bin in which the vote has been cast.
84  */
85  int
86  vote (const Eigen::Vector3d &single_vote_coord, double weight, int voter_id);
87 
88  /** \brief Vote for a given position in the 3D space. The weight is interpolated between the bin pointed by single_vote_coord and its neighbors.
89  *
90  * \param[in] single_vote_coord coordinates of the vote being cast.
91  * \param[in] weight weight associated with the vote.
92  * \param[in] voter_id the numeric id of the voter. Useful to trace back the voting correspondence, if the vote is returned by findMaxima as a part of a maximum of the Hough Space.
93  * \return the index of the bin in which the vote has been cast.
94  */
95  int
96  voteInt (const Eigen::Vector3d &single_vote_coord, double weight, int voter_id);
97 
98  /** \brief Find the bins with most votes.
99  *
100  * \param[in] min_threshold the minimum number of votes to be included in a bin in order to have its value returned.
101  * If set to a value between -1 and 0 the Hough space maximum_vote is found and the returned values are all the votes greater than -min_threshold * maximum_vote.
102  * \param[out] maxima_values the list of Hough Space bin values greater than min_threshold.
103  * \param[out] maxima_voter_ids for each value returned, a list of the voter ids who cast a vote in that position.
104  * \return The min_threshold used, either set by the user or found by this method.
105  */
106  double
107  findMaxima (double min_threshold, std::vector<double> & maxima_values, std::vector<std::vector<int> > &maxima_voter_ids);
108 
109  protected:
110 
111  /** \brief Minimum coordinate in the Hough Space. */
112  Eigen::Vector3d min_coord_;
113 
114  /** \brief Size of each bin in the Hough Space. */
115  Eigen::Vector3d bin_size_;
116 
117  /** \brief Number of bins for each dimension. */
118  Eigen::Vector3i bin_count_;
119 
120  /** \brief Used to access hough_space_ as if it was a matrix. */
121  int partial_bin_products_[4]{};
122 
123  /** \brief Total number of bins in the Hough Space. */
124  int total_bins_count_{0};
125 
126  /** \brief The Hough Space. */
127  std::vector<double> hough_space_;
128 
129  /** \brief List of voters for each bin. */
130  std::unordered_map<int, std::vector<int> > voter_ids_;
131  };
132  }
133 
134  /** \brief Class implementing a 3D correspondence grouping algorithm that can deal with multiple instances of a model template
135  * found into a given scene. Each correspondence casts a vote for a reference point in a 3D Hough Space.
136  * The remaining 3 DOF are taken into account by associating each correspondence with a local Reference Frame.
137  * The suggested PointModelRfT is pcl::ReferenceFrame
138  *
139  * \note If you use this code in any academic work, please cite the original paper:
140  * - F. Tombari, L. Di Stefano:
141  * Object recognition in 3D scenes with occlusions and clutter by Hough voting.
142  * 2010, Fourth Pacific-Rim Symposium on Image and Video Technology
143  *
144  * \author Federico Tombari (original), Tommaso Cavallari (PCL port)
145  * \ingroup recognition
146  */
147  template<typename PointModelT, typename PointSceneT, typename PointModelRfT = pcl::ReferenceFrame, typename PointSceneRfT = pcl::ReferenceFrame>
148  class Hough3DGrouping : public CorrespondenceGrouping<PointModelT, PointSceneT>
149  {
150  public:
154 
158 
160  using PointCloudPtr = typename PointCloud::Ptr;
162 
164 
165  /** \brief Constructor */
167  : input_rf_ ()
168  , scene_rf_ ()
169  {}
170 
171  /** \brief Provide a pointer to the input dataset.
172  * \param[in] cloud the const boost shared pointer to a PointCloud message.
173  */
174  inline void
175  setInputCloud (const PointCloudConstPtr &cloud) override
176  {
178  needs_training_ = true;
179  hough_space_initialized_ = false;
180  input_rf_.reset();
181  }
182 
183  /** \brief Provide a pointer to the input dataset's reference frames.
184  * Each point in the reference frame cloud should be the reference frame of
185  * the correspondent point in the input dataset.
186  *
187  * \param[in] input_rf the pointer to the input cloud's reference frames.
188  */
189  inline void
191  {
192  input_rf_ = input_rf;
193  needs_training_ = true;
194  hough_space_initialized_ = false;
195  }
196 
197  /** \brief Getter for the input dataset's reference frames.
198  * Each point in the reference frame cloud should be the reference frame of
199  * the correspondent point in the input dataset.
200  *
201  * \return the pointer to the input cloud's reference frames.
202  */
203  inline ModelRfCloudConstPtr
204  getInputRf () const
205  {
206  return (input_rf_);
207  }
208 
209  /** \brief Provide a pointer to the scene dataset (i.e. the cloud in which the algorithm has to search for instances of the input model)
210  *
211  * \param[in] scene the const boost shared pointer to a PointCloud message.
212  */
213  inline void
214  setSceneCloud (const SceneCloudConstPtr &scene) override
215  {
216  scene_ = scene;
217  hough_space_initialized_ = false;
218  scene_rf_.reset();
219  }
220 
221  /** \brief Provide a pointer to the scene dataset's reference frames.
222  * Each point in the reference frame cloud should be the reference frame of
223  * the correspondent point in the scene dataset.
224  *
225  * \param[in] scene_rf the pointer to the scene cloud's reference frames.
226  */
227  inline void
229  {
230  scene_rf_ = scene_rf;
231  hough_space_initialized_ = false;
232  }
233 
234  /** \brief Getter for the scene dataset's reference frames.
235  * Each point in the reference frame cloud should be the reference frame of
236  * the correspondent point in the scene dataset.
237  *
238  * \return the pointer to the scene cloud's reference frames.
239  */
240  inline SceneRfCloudConstPtr
241  getSceneRf () const
242  {
243  return (scene_rf_);
244  }
245 
246  /** \brief Provide a pointer to the precomputed correspondences between points in the input dataset and
247  * points in the scene dataset. The correspondences are going to be clustered into different model instances
248  * by the algorithm.
249  *
250  * \param[in] corrs the correspondences between the model and the scene.
251  */
252  inline void
254  {
255  model_scene_corrs_ = corrs;
256  hough_space_initialized_ = false;
257  }
258 
259  /** \brief Sets the minimum number of votes in the Hough space needed to infer the presence of a model instance into the scene cloud.
260  *
261  * \param[in] threshold the threshold for the Hough space voting, if set between -1 and 0 the maximum vote in the
262  * entire space is automatically calculated and -threshold the maximum value is used as a threshold. This means
263  * that a value between -1 and 0 should be used only if at least one instance of the model is always present in
264  * the scene, or if this false positive can be filtered later.
265  */
266  inline void
267  setHoughThreshold (double threshold)
268  {
269  hough_threshold_ = threshold;
270  }
271 
272  /** \brief Gets the minimum number of votes in the Hough space needed to infer the presence of a model instance into the scene cloud.
273  *
274  * \return the threshold for the Hough space voting.
275  */
276  inline double
278  {
279  return (hough_threshold_);
280  }
281 
282  /** \brief Sets the size of each bin into the Hough space.
283  *
284  * \param[in] bin_size the size of each Hough space's bin.
285  */
286  inline void
287  setHoughBinSize (double bin_size)
288  {
289  hough_bin_size_ = bin_size;
290  hough_space_initialized_ = false;
291  }
292 
293  /** \brief Gets the size of each bin into the Hough space.
294  *
295  * \return the size of each Hough space's bin.
296  */
297  inline double
299  {
300  return (hough_bin_size_);
301  }
302 
303  /** \brief Sets whether the vote casting procedure interpolates
304  * the score between neighboring bins of the Hough space or not.
305  *
306  * \param[in] use_interpolation the algorithm should interpolate the vote score between neighboring bins.
307  */
308  inline void
309  setUseInterpolation (bool use_interpolation)
310  {
311  use_interpolation_ = use_interpolation;
312  hough_space_initialized_ = false;
313  }
314 
315  /** \brief Gets whether the vote casting procedure interpolates
316  * the score between neighboring bins of the Hough space or not.
317  *
318  * \return if the algorithm should interpolate the vote score between neighboring bins.
319  */
320  inline bool
322  {
323  return (use_interpolation_);
324  }
325 
326  /** \brief Sets whether the vote casting procedure uses the correspondence's distance as a score.
327  *
328  * \param[in] use_distance_weight the algorithm should use the weighted distance when calculating the Hough voting score.
329  */
330  inline void
331  setUseDistanceWeight (bool use_distance_weight)
332  {
333  use_distance_weight_ = use_distance_weight;
334  hough_space_initialized_ = false;
335  }
336 
337  /** \brief Gets whether the vote casting procedure uses the correspondence's distance as a score.
338  *
339  * \return if the algorithm should use the weighted distance when calculating the Hough voting score.
340  */
341  inline bool
343  {
344  return (use_distance_weight_);
345  }
346 
347  /** \brief If the Local reference frame has not been set for either the model cloud or the scene cloud,
348  * this algorithm makes the computation itself but needs a suitable search radius to compute the normals
349  * in order to subsequently compute the RF (if not set a default 15 nearest neighbors search is performed).
350  *
351  * \param[in] local_rf_normals_search_radius the normals search radius for the local reference frame calculation.
352  */
353  inline void
354  setLocalRfNormalsSearchRadius (float local_rf_normals_search_radius)
355  {
356  local_rf_normals_search_radius_ = local_rf_normals_search_radius;
357  needs_training_ = true;
358  hough_space_initialized_ = false;
359  }
360 
361  /** \brief If the Local reference frame has not been set for either the model cloud or the scene cloud,
362  * this algorithm makes the computation itself but needs a suitable search radius to compute the normals
363  * in order to subsequently compute the RF (if not set a default 15 nearest neighbors search is performed).
364  *
365  * \return the normals search radius for the local reference frame calculation.
366  */
367  inline float
369  {
371  }
372 
373  /** \brief If the Local reference frame has not been set for either the model cloud or the scene cloud,
374  * this algorithm makes the computation itself but needs a suitable search radius to do so.
375  * \attention This parameter NEEDS to be set if the reference frames are not precomputed externally,
376  * otherwise the recognition results won't be correct.
377  *
378  * \param[in] local_rf_search_radius the search radius for the local reference frame calculation.
379  */
380  inline void
381  setLocalRfSearchRadius (float local_rf_search_radius)
382  {
383  local_rf_search_radius_ = local_rf_search_radius;
384  needs_training_ = true;
385  hough_space_initialized_ = false;
386  }
387 
388  /** \brief If the Local reference frame has not been set for either the model cloud or the scene cloud,
389  * this algorithm makes the computation itself but needs a suitable search radius to do so.
390  * \attention This parameter NEEDS to be set if the reference frames are not precomputed externally,
391  * otherwise the recognition results won't be correct.
392  *
393  * \return the search radius for the local reference frame calculation.
394  */
395  inline float
397  {
398  return (local_rf_search_radius_);
399  }
400 
401  /** \brief Call this function after setting the input, the input_rf and the hough_bin_size parameters to perform an off line training of the algorithm. This might be useful if one wants to perform once and for all a pre-computation of votes that only concern the models, increasing the on-line efficiency of the grouping algorithm.
402  * The algorithm is automatically trained on the first invocation of the recognize method or the cluster method if this training function has not been manually invoked.
403  *
404  * \return true if the training had been successful or false if errors have occurred.
405  */
406  bool
407  train ();
408 
409  /** \brief The main function, recognizes instances of the model into the scene set by the user.
410  *
411  * \param[out] transformations a vector containing one transformation matrix for each instance of the model recognized into the scene.
412  *
413  * \return true if the recognition had been successful or false if errors have occurred.
414  */
415  bool
416  recognize (std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > &transformations);
417 
418  /** \brief The main function, recognizes instances of the model into the scene set by the user.
419  *
420  * \param[out] transformations a vector containing one transformation matrix for each instance of the model recognized into the scene.
421  * \param[out] clustered_corrs a vector containing the correspondences for each instance of the model found within the input data (the same output of clusterCorrespondences).
422  *
423  * \return true if the recognition had been successful or false if errors have occurred.
424  */
425  bool
426  recognize (std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > &transformations, std::vector<pcl::Correspondences> &clustered_corrs);
427 
428  protected:
432 
433  /** \brief The input Rf cloud. */
435 
436  /** \brief The scene Rf cloud. */
438 
439  /** \brief If the training of the Hough space is needed; set on change of either the input cloud or the input_rf. */
440  bool needs_training_{true};
441 
442  /** \brief The result of the training. The vector between each model point and the centroid of the model adjusted by its local reference frame.*/
443  std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > model_votes_;
444 
445  /** \brief The minimum number of votes in the Hough space needed to infer the presence of a model instance into the scene cloud. */
446  double hough_threshold_{-1.0};
447 
448  /** \brief The size of each bin of the hough space. */
449  double hough_bin_size_{1.0};
450 
451  /** \brief Use the interpolation between neighboring Hough bins when casting votes. */
452  bool use_interpolation_{true};
453 
454  /** \brief Use the weighted correspondence distance when casting votes. */
455  bool use_distance_weight_{false};
456 
457  /** \brief Normals search radius for the potential Rf calculation. */
459 
460  /** \brief Search radius for the potential Rf calculation. */
462 
463  /** \brief The Hough space. */
465 
466  /** \brief Transformations found by clusterCorrespondences method. */
467  std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > found_transformations_;
468 
469  /** \brief Whether the Hough space already contains the correct votes for the current input parameters and so the cluster and recognize calls don't need to recompute each value.
470  * Reset on the change of any parameter except the hough_threshold.
471  */
473 
474  /** \brief Cluster the input correspondences in order to distinguish between different instances of the model into the scene.
475  *
476  * \param[out] model_instances a vector containing the clustered correspondences for each model found on the scene.
477  * \return true if the clustering had been successful or false if errors have occurred.
478  */
479  void
480  clusterCorrespondences (std::vector<Correspondences> &model_instances) override;
481 
482  /* \brief Finds the transformation matrix between the input and the scene cloud for a set of correspondences using a RANSAC algorithm.
483  * \param[in] the scene cloud in which the PointSceneT has been converted to PointModelT.
484  * \param[in] corrs a set of correspondences.
485  * \param[out] transform the transformation matrix between the input cloud and the scene cloud that aligns the found correspondences.
486  * \return true if the recognition had been successful or false if errors have occurred.
487  */
488  //bool
489  //getTransformMatrix (const PointCloudConstPtr &scene_cloud, const Correspondences &corrs, Eigen::Matrix4f &transform);
490 
491  /** \brief The Hough space voting procedure.
492  * \return true if the voting had been successful or false if errors have occurred.
493  */
494  bool
495  houghVoting ();
496 
497  /** \brief Computes the reference frame for an input cloud.
498  * \param[in] input the input cloud.
499  * \param[out] rf the resulting reference frame.
500  */
501  template<typename PointType, typename PointRfType> void
503  };
504 }
505 
506 #ifdef PCL_NO_PRECOMPILE
507 #include <pcl/recognition/impl/cg/hough_3d.hpp>
508 #endif
Abstract base class for Correspondence Grouping algorithms.
CorrespondencesConstPtr model_scene_corrs_
The correspondences between points in the input and the scene datasets.
SceneCloudConstPtr scene_
The scene cloud.
typename SceneCloud::ConstPtr SceneCloudConstPtr
Class implementing a 3D correspondence grouping algorithm that can deal with multiple instances of a ...
Definition: hough_3d.h:149
void setUseInterpolation(bool use_interpolation)
Sets whether the vote casting procedure interpolates the score between neighboring bins of the Hough ...
Definition: hough_3d.h:309
ModelRfCloudConstPtr getInputRf() const
Getter for the input dataset's reference frames.
Definition: hough_3d.h:204
bool getUseDistanceWeight() const
Gets whether the vote casting procedure uses the correspondence's distance as a score.
Definition: hough_3d.h:342
float local_rf_normals_search_radius_
Normals search radius for the potential Rf calculation.
Definition: hough_3d.h:458
bool getUseInterpolation() const
Gets whether the vote casting procedure interpolates the score between neighboring bins of the Hough ...
Definition: hough_3d.h:321
void setLocalRfNormalsSearchRadius(float local_rf_normals_search_radius)
If the Local reference frame has not been set for either the model cloud or the scene cloud,...
Definition: hough_3d.h:354
void setLocalRfSearchRadius(float local_rf_search_radius)
If the Local reference frame has not been set for either the model cloud or the scene cloud,...
Definition: hough_3d.h:381
typename SceneRfCloud::ConstPtr SceneRfCloudConstPtr
Definition: hough_3d.h:157
void setSceneRf(const SceneRfCloudConstPtr &scene_rf)
Provide a pointer to the scene dataset's reference frames.
Definition: hough_3d.h:228
float getLocalRfNormalsSearchRadius() const
If the Local reference frame has not been set for either the model cloud or the scene cloud,...
Definition: hough_3d.h:368
bool recognize(std::vector< Eigen::Matrix4f, Eigen::aligned_allocator< Eigen::Matrix4f > > &transformations)
The main function, recognizes instances of the model into the scene set by the user.
Definition: hough_3d.hpp:334
double hough_threshold_
The minimum number of votes in the Hough space needed to infer the presence of a model instance into ...
Definition: hough_3d.h:446
typename ModelRfCloud::Ptr ModelRfCloudPtr
Definition: hough_3d.h:152
typename SceneRfCloud::Ptr SceneRfCloudPtr
Definition: hough_3d.h:156
bool use_distance_weight_
Use the weighted correspondence distance when casting votes.
Definition: hough_3d.h:455
double getHoughThreshold() const
Gets the minimum number of votes in the Hough space needed to infer the presence of a model instance ...
Definition: hough_3d.h:277
bool houghVoting()
The Hough space voting procedure.
Definition: hough_3d.hpp:138
bool needs_training_
If the training of the Hough space is needed; set on change of either the input cloud or the input_rf...
Definition: hough_3d.h:440
void setInputCloud(const PointCloudConstPtr &cloud) override
Provide a pointer to the input dataset.
Definition: hough_3d.h:175
bool train()
Call this function after setting the input, the input_rf and the hough_bin_size parameters to perform...
Definition: hough_3d.hpp:85
float getLocalRfSearchRadius() const
If the Local reference frame has not been set for either the model cloud or the scene cloud,...
Definition: hough_3d.h:396
bool hough_space_initialized_
Whether the Hough space already contains the correct votes for the current input parameters and so th...
Definition: hough_3d.h:472
double hough_bin_size_
The size of each bin of the hough space.
Definition: hough_3d.h:449
typename ModelRfCloud::ConstPtr ModelRfCloudConstPtr
Definition: hough_3d.h:153
typename PointCloud::ConstPtr PointCloudConstPtr
Definition: hough_3d.h:161
std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > model_votes_
The result of the training.
Definition: hough_3d.h:443
void setHoughBinSize(double bin_size)
Sets the size of each bin into the Hough space.
Definition: hough_3d.h:287
double getHoughBinSize() const
Gets the size of each bin into the Hough space.
Definition: hough_3d.h:298
void setInputRf(const ModelRfCloudConstPtr &input_rf)
Provide a pointer to the input dataset's reference frames.
Definition: hough_3d.h:190
std::vector< Eigen::Matrix4f, Eigen::aligned_allocator< Eigen::Matrix4f > > found_transformations_
Transformations found by clusterCorrespondences method.
Definition: hough_3d.h:467
void computeRf(const typename pcl::PointCloud< PointType >::ConstPtr &input, pcl::PointCloud< PointRfType > &rf)
Computes the reference frame for an input cloud.
Definition: hough_3d.hpp:55
void setSceneCloud(const SceneCloudConstPtr &scene) override
Provide a pointer to the scene dataset (i.e.
Definition: hough_3d.h:214
pcl::recognition::HoughSpace3D::Ptr hough_space_
The Hough space.
Definition: hough_3d.h:464
ModelRfCloudConstPtr input_rf_
The input Rf cloud.
Definition: hough_3d.h:434
void setHoughThreshold(double threshold)
Sets the minimum number of votes in the Hough space needed to infer the presence of a model instance ...
Definition: hough_3d.h:267
void setUseDistanceWeight(bool use_distance_weight)
Sets whether the vote casting procedure uses the correspondence's distance as a score.
Definition: hough_3d.h:331
Hough3DGrouping()
Constructor.
Definition: hough_3d.h:166
typename PointCloud::Ptr PointCloudPtr
Definition: hough_3d.h:160
SceneRfCloudConstPtr getSceneRf() const
Getter for the scene dataset's reference frames.
Definition: hough_3d.h:241
void setModelSceneCorrespondences(const CorrespondencesConstPtr &corrs) override
Provide a pointer to the precomputed correspondences between points in the input dataset and points i...
Definition: hough_3d.h:253
float local_rf_search_radius_
Search radius for the potential Rf calculation.
Definition: hough_3d.h:461
bool use_interpolation_
Use the interpolation between neighboring Hough bins when casting votes.
Definition: hough_3d.h:452
SceneRfCloudConstPtr scene_rf_
The scene Rf cloud.
Definition: hough_3d.h:437
void clusterCorrespondences(std::vector< Correspondences > &model_instances) override
Cluster the input correspondences in order to distinguish between different instances of the model in...
Definition: hough_3d.hpp:259
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
Definition: pcl_base.hpp:65
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition: point_cloud.h:173
shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:413
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:414
HoughSpace3D is a 3D voting space.
Definition: hough_3d.h:58
void reset()
Reset all cast votes.
Eigen::Vector3i bin_count_
Number of bins for each dimension.
Definition: hough_3d.h:118
double findMaxima(double min_threshold, std::vector< double > &maxima_values, std::vector< std::vector< int > > &maxima_voter_ids)
Find the bins with most votes.
int vote(const Eigen::Vector3d &single_vote_coord, double weight, int voter_id)
Casting a vote for a given position in the Hough space.
std::vector< double > hough_space_
The Hough Space.
Definition: hough_3d.h:127
std::unordered_map< int, std::vector< int > > voter_ids_
List of voters for each bin.
Definition: hough_3d.h:130
int voteInt(const Eigen::Vector3d &single_vote_coord, double weight, int voter_id)
Vote for a given position in the 3D space.
HoughSpace3D(const Eigen::Vector3d &min_coord, const Eigen::Vector3d &bin_size, const Eigen::Vector3d &max_coord)
Constructor.
Eigen::Vector3d min_coord_
Minimum coordinate in the Hough Space.
Definition: hough_3d.h:112
shared_ptr< HoughSpace3D > Ptr
Definition: hough_3d.h:63
Eigen::Vector3d bin_size_
Size of each bin in the Hough Space.
Definition: hough_3d.h:115
shared_ptr< const HoughSpace3D > ConstPtr
Definition: hough_3d.h:64
Defines all the PCL implemented PointT point type structures.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition: memory.h:86
Defines functions, macros and traits for allocating and using memory.
shared_ptr< const Correspondences > CorrespondencesConstPtr
Defines all the PCL and non-PCL macros used.
#define PCL_EXPORTS
Definition: pcl_macros.h:325