Point Cloud Library (PCL)  1.11.0-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/recognition/boost.h>
44 #include <pcl/memory.h>
45 #include <pcl/pcl_macros.h>
46 #include <pcl/point_types.h>
47 
48 #include <unordered_map>
49 
50 namespace pcl
51 {
52  namespace recognition
53  {
54  /** \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.
55  * \author Federico Tombari (original), Tommaso Cavallari (PCL port)
56  * \ingroup recognition
57  */
59  {
60 
61  public:
63 
64  using Ptr = shared_ptr<HoughSpace3D>;
65  using ConstPtr = shared_ptr<const HoughSpace3D>;
66 
67  /** \brief Constructor
68  *
69  * \param[in] min_coord minimum (x,y,z) coordinates of the Hough space
70  * \param[in] bin_size size of each bing of the Hough space.
71  * \param[in] max_coord maximum (x,y,z) coordinates of the Hough space.
72  */
73  HoughSpace3D (const Eigen::Vector3d &min_coord, const Eigen::Vector3d &bin_size, const Eigen::Vector3d &max_coord);
74 
75  /** \brief Reset all cast votes. */
76  void
77  reset ();
78 
79  /** \brief Casting a vote for a given position in the Hough space.
80  *
81  * \param[in] single_vote_coord coordinates of the vote being cast (in absolute coordinates)
82  * \param[in] weight weight associated with the vote.
83  * \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.
84  * \return the index of the bin in which the vote has been cast.
85  */
86  int
87  vote (const Eigen::Vector3d &single_vote_coord, double weight, int voter_id);
88 
89  /** \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.
90  *
91  * \param[in] single_vote_coord coordinates of the vote being cast.
92  * \param[in] weight weight associated with the vote.
93  * \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.
94  * \return the index of the bin in which the vote has been cast.
95  */
96  int
97  voteInt (const Eigen::Vector3d &single_vote_coord, double weight, int voter_id);
98 
99  /** \brief Find the bins with most votes.
100  *
101  * \param[in] min_threshold the minimum number of votes to be included in a bin in order to have its value returned.
102  * 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.
103  * \param[out] maxima_values the list of Hough Space bin values greater than min_threshold.
104  * \param[out] maxima_voter_ids for each value returned, a list of the voter ids who cast a vote in that position.
105  * \return The min_threshold used, either set by the user or found by this method.
106  */
107  double
108  findMaxima (double min_threshold, std::vector<double> & maxima_values, std::vector<std::vector<int> > &maxima_voter_ids);
109 
110  protected:
111 
112  /** \brief Minimum coordinate in the Hough Space. */
113  Eigen::Vector3d min_coord_;
114 
115  /** \brief Size of each bin in the Hough Space. */
116  Eigen::Vector3d bin_size_;
117 
118  /** \brief Number of bins for each dimension. */
119  Eigen::Vector3i bin_count_;
120 
121  /** \brief Used to access hough_space_ as if it was a matrix. */
122  int partial_bin_products_[4];
123 
124  /** \brief Total number of bins in the Hough Space. */
126 
127  /** \brief The Hough Space. */
128  std::vector<double> hough_space_;
129 
130  /** \brief List of voters for each bin. */
131  std::unordered_map<int, std::vector<int> > voter_ids_;
132  };
133  }
134 
135  /** \brief Class implementing a 3D correspondence grouping algorithm that can deal with multiple instances of a model template
136  * found into a given scene. Each correspondence casts a vote for a reference point in a 3D Hough Space.
137  * The remaining 3 DOF are taken into account by associating each correspondence with a local Reference Frame.
138  * The suggested PointModelRfT is pcl::ReferenceFrame
139  *
140  * \note If you use this code in any academic work, please cite the original paper:
141  * - F. Tombari, L. Di Stefano:
142  * Object recognition in 3D scenes with occlusions and clutter by Hough voting.
143  * 2010, Fourth Pacific-Rim Symposium on Image and Video Technology
144  *
145  * \author Federico Tombari (original), Tommaso Cavallari (PCL port)
146  * \ingroup recognition
147  */
148  template<typename PointModelT, typename PointSceneT, typename PointModelRfT = pcl::ReferenceFrame, typename PointSceneRfT = pcl::ReferenceFrame>
149  class Hough3DGrouping : public CorrespondenceGrouping<PointModelT, PointSceneT>
150  {
151  public:
155 
159 
161  using PointCloudPtr = typename PointCloud::Ptr;
163 
165 
166  /** \brief Constructor */
168  : input_rf_ ()
169  , scene_rf_ ()
170  , needs_training_ (true)
171  ,hough_threshold_ (-1)
172  , hough_bin_size_ (1.0)
173  , use_interpolation_ (true)
174  , use_distance_weight_ (false)
176  , local_rf_search_radius_ (0.0f)
177  , hough_space_initialized_ (false)
178  {}
179 
180  /** \brief Provide a pointer to the input dataset.
181  * \param[in] cloud the const boost shared pointer to a PointCloud message.
182  */
183  inline void
184  setInputCloud (const PointCloudConstPtr &cloud) override
185  {
187  needs_training_ = true;
188  hough_space_initialized_ = false;
189  input_rf_.reset();
190  }
191 
192  /** \brief Provide a pointer to the input dataset's reference frames.
193  * Each point in the reference frame cloud should be the reference frame of
194  * the correspondent point in the input dataset.
195  *
196  * \param[in] input_rf the pointer to the input cloud's reference frames.
197  */
198  inline void
200  {
201  input_rf_ = input_rf;
202  needs_training_ = true;
203  hough_space_initialized_ = false;
204  }
205 
206  /** \brief Getter for the input dataset's reference frames.
207  * Each point in the reference frame cloud should be the reference frame of
208  * the correspondent point in the input dataset.
209  *
210  * \return the pointer to the input cloud's reference frames.
211  */
212  inline ModelRfCloudConstPtr
213  getInputRf () const
214  {
215  return (input_rf_);
216  }
217 
218  /** \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)
219  *
220  * \param[in] scene the const boost shared pointer to a PointCloud message.
221  */
222  inline void
223  setSceneCloud (const SceneCloudConstPtr &scene) override
224  {
225  scene_ = scene;
226  hough_space_initialized_ = false;
227  scene_rf_.reset();
228  }
229 
230  /** \brief Provide a pointer to the scene dataset's reference frames.
231  * Each point in the reference frame cloud should be the reference frame of
232  * the correspondent point in the scene dataset.
233  *
234  * \param[in] scene_rf the pointer to the scene cloud's reference frames.
235  */
236  inline void
238  {
239  scene_rf_ = scene_rf;
240  hough_space_initialized_ = false;
241  }
242 
243  /** \brief Getter for the scene dataset's reference frames.
244  * Each point in the reference frame cloud should be the reference frame of
245  * the correspondent point in the scene dataset.
246  *
247  * \return the pointer to the scene cloud's reference frames.
248  */
249  inline SceneRfCloudConstPtr
250  getSceneRf () const
251  {
252  return (scene_rf_);
253  }
254 
255  /** \brief Provide a pointer to the precomputed correspondences between points in the input dataset and
256  * points in the scene dataset. The correspondences are going to be clustered into different model instances
257  * by the algorithm.
258  *
259  * \param[in] corrs the correspondences between the model and the scene.
260  */
261  inline void
263  {
264  model_scene_corrs_ = corrs;
265  hough_space_initialized_ = false;
266  }
267 
268  /** \brief Sets the minimum number of votes in the Hough space needed to infer the presence of a model instance into the scene cloud.
269  *
270  * \param[in] threshold the threshold for the Hough space voting, if set between -1 and 0 the maximum vote in the
271  * entire space is automatically calculated and -threshold the maximum value is used as a threshold. This means
272  * that a value between -1 and 0 should be used only if at least one instance of the model is always present in
273  * the scene, or if this false positive can be filtered later.
274  */
275  inline void
276  setHoughThreshold (double threshold)
277  {
278  hough_threshold_ = threshold;
279  }
280 
281  /** \brief Gets the minimum number of votes in the Hough space needed to infer the presence of a model instance into the scene cloud.
282  *
283  * \return the threshold for the Hough space voting.
284  */
285  inline double
287  {
288  return (hough_threshold_);
289  }
290 
291  /** \brief Sets the size of each bin into the Hough space.
292  *
293  * \param[in] bin_size the size of each Hough space's bin.
294  */
295  inline void
296  setHoughBinSize (double bin_size)
297  {
298  hough_bin_size_ = bin_size;
299  hough_space_initialized_ = false;
300  }
301 
302  /** \brief Gets the size of each bin into the Hough space.
303  *
304  * \return the size of each Hough space's bin.
305  */
306  inline double
308  {
309  return (hough_bin_size_);
310  }
311 
312  /** \brief Sets whether the vote casting procedure interpolates
313  * the score between neighboring bins of the Hough space or not.
314  *
315  * \param[in] use_interpolation the algorithm should interpolate the vote score between neighboring bins.
316  */
317  inline void
318  setUseInterpolation (bool use_interpolation)
319  {
320  use_interpolation_ = use_interpolation;
321  hough_space_initialized_ = false;
322  }
323 
324  /** \brief Gets whether the vote casting procedure interpolates
325  * the score between neighboring bins of the Hough space or not.
326  *
327  * \return if the algorithm should interpolate the vote score between neighboring bins.
328  */
329  inline bool
331  {
332  return (use_interpolation_);
333  }
334 
335  /** \brief Sets whether the vote casting procedure uses the correspondence's distance as a score.
336  *
337  * \param[in] use_distance_weight the algorithm should use the weighted distance when calculating the Hough voting score.
338  */
339  inline void
340  setUseDistanceWeight (bool use_distance_weight)
341  {
342  use_distance_weight_ = use_distance_weight;
343  hough_space_initialized_ = false;
344  }
345 
346  /** \brief Gets whether the vote casting procedure uses the correspondence's distance as a score.
347  *
348  * \return if the algorithm should use the weighted distance when calculating the Hough voting score.
349  */
350  inline bool
352  {
353  return (use_distance_weight_);
354  }
355 
356  /** \brief If the Local reference frame has not been set for either the model cloud or the scene cloud,
357  * this algorithm makes the computation itself but needs a suitable search radius to compute the normals
358  * in order to subsequently compute the RF (if not set a default 15 nearest neighbors search is performed).
359  *
360  * \param[in] local_rf_normals_search_radius the normals search radius for the local reference frame calculation.
361  */
362  inline void
363  setLocalRfNormalsSearchRadius (float local_rf_normals_search_radius)
364  {
365  local_rf_normals_search_radius_ = local_rf_normals_search_radius;
366  needs_training_ = true;
367  hough_space_initialized_ = false;
368  }
369 
370  /** \brief If the Local reference frame has not been set for either the model cloud or the scene cloud,
371  * this algorithm makes the computation itself but needs a suitable search radius to compute the normals
372  * in order to subsequently compute the RF (if not set a default 15 nearest neighbors search is performed).
373  *
374  * \return the normals search radius for the local reference frame calculation.
375  */
376  inline float
378  {
380  }
381 
382  /** \brief If the Local reference frame has not been set for either the model cloud or the scene cloud,
383  * this algorithm makes the computation itself but needs a suitable search radius to do so.
384  * \attention This parameter NEEDS to be set if the reference frames are not precomputed externally,
385  * otherwise the recognition results won't be correct.
386  *
387  * \param[in] local_rf_search_radius the search radius for the local reference frame calculation.
388  */
389  inline void
390  setLocalRfSearchRadius (float local_rf_search_radius)
391  {
392  local_rf_search_radius_ = local_rf_search_radius;
393  needs_training_ = true;
394  hough_space_initialized_ = false;
395  }
396 
397  /** \brief If the Local reference frame has not been set for either the model cloud or the scene cloud,
398  * this algorithm makes the computation itself but needs a suitable search radius to do so.
399  * \attention This parameter NEEDS to be set if the reference frames are not precomputed externally,
400  * otherwise the recognition results won't be correct.
401  *
402  * \return the search radius for the local reference frame calculation.
403  */
404  inline float
406  {
407  return (local_rf_search_radius_);
408  }
409 
410  /** \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.
411  * 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.
412  *
413  * \return true if the training had been successful or false if errors have occurred.
414  */
415  bool
416  train ();
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  *
422  * \return true if the recognition had been successful or false if errors have occurred.
423  */
424  bool
425  recognize (std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > &transformations);
426 
427  /** \brief The main function, recognizes instances of the model into the scene set by the user.
428  *
429  * \param[out] transformations a vector containing one transformation matrix for each instance of the model recognized into the scene.
430  * \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).
431  *
432  * \return true if the recognition had been successful or false if errors have occurred.
433  */
434  bool
435  recognize (std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > &transformations, std::vector<pcl::Correspondences> &clustered_corrs);
436 
437  protected:
441 
442  /** \brief The input Rf cloud. */
444 
445  /** \brief The scene Rf cloud. */
447 
448  /** \brief If the training of the Hough space is needed; set on change of either the input cloud or the input_rf. */
450 
451  /** \brief The result of the training. The vector between each model point and the centroid of the model adjusted by its local reference frame.*/
452  std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > model_votes_;
453 
454  /** \brief The minimum number of votes in the Hough space needed to infer the presence of a model instance into the scene cloud. */
456 
457  /** \brief The size of each bin of the hough space. */
459 
460  /** \brief Use the interpolation between neighboring Hough bins when casting votes. */
462 
463  /** \brief Use the weighted correspondence distance when casting votes. */
465 
466  /** \brief Normals search radius for the potential Rf calculation. */
468 
469  /** \brief Search radius for the potential Rf calculation. */
471 
472  /** \brief The Hough space. */
474 
475  /** \brief Transformations found by clusterCorrespondences method. */
476  std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > found_transformations_;
477 
478  /** \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.
479  * Reset on the change of any parameter except the hough_threshold.
480  */
482 
483  /** \brief Cluster the input correspondences in order to distinguish between different instances of the model into the scene.
484  *
485  * \param[out] model_instances a vector containing the clustered correspondences for each model found on the scene.
486  * \return true if the clustering had been successful or false if errors have occurred.
487  */
488  void
489  clusterCorrespondences (std::vector<Correspondences> &model_instances) override;
490 
491  /* \brief Finds the transformation matrix between the input and the scene cloud for a set of correspondences using a RANSAC algorithm.
492  * \param[in] the scene cloud in which the PointSceneT has been converted to PointModelT.
493  * \param[in] corrs a set of correspondences.
494  * \param[out] transform the transformation matrix between the input cloud and the scene cloud that aligns the found correspondences.
495  * \return true if the recognition had been successful or false if errors have occurred.
496  */
497  //bool
498  //getTransformMatrix (const PointCloudConstPtr &scene_cloud, const Correspondences &corrs, Eigen::Matrix4f &transform);
499 
500  /** \brief The Hough space voting procedure.
501  * \return true if the voting had been successful or false if errors have occurred.
502  */
503  bool
504  houghVoting ();
505 
506  /** \brief Computes the reference frame for an input cloud.
507  * \param[in] input the input cloud.
508  * \param[out] rf the resulting reference frame.
509  */
510  template<typename PointType, typename PointRfType> void
512  };
513 }
514 
515 #ifdef PCL_NO_PRECOMPILE
516 #include <pcl/recognition/impl/cg/hough_3d.hpp>
517 #endif
pcl::Hough3DGrouping::getInputRf
ModelRfCloudConstPtr getInputRf() const
Getter for the input dataset's reference frames.
Definition: hough_3d.h:213
pcl::Hough3DGrouping::use_distance_weight_
bool use_distance_weight_
Use the weighted correspondence distance when casting votes.
Definition: hough_3d.h:464
pcl_macros.h
Defines all the PCL and non-PCL macros used.
pcl
Definition: convolution.h:46
pcl::Hough3DGrouping::clusterCorrespondences
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:258
point_types.h
pcl::CorrespondenceGrouping::SceneCloudConstPtr
typename SceneCloud::ConstPtr SceneCloudConstPtr
Definition: correspondence_grouping.h:59
pcl::Hough3DGrouping::getSceneRf
SceneRfCloudConstPtr getSceneRf() const
Getter for the scene dataset's reference frames.
Definition: hough_3d.h:250
pcl::Hough3DGrouping::getUseDistanceWeight
bool getUseDistanceWeight() const
Gets whether the vote casting procedure uses the correspondence's distance as a score.
Definition: hough_3d.h:351
pcl::Hough3DGrouping::model_votes_
std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > model_votes_
The result of the training.
Definition: hough_3d.h:452
pcl::Hough3DGrouping::ModelRfCloudPtr
typename ModelRfCloud::Ptr ModelRfCloudPtr
Definition: hough_3d.h:153
pcl::Hough3DGrouping::found_transformations_
std::vector< Eigen::Matrix4f, Eigen::aligned_allocator< Eigen::Matrix4f > > found_transformations_
Transformations found by clusterCorrespondences method.
Definition: hough_3d.h:476
pcl::Hough3DGrouping::setModelSceneCorrespondences
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:262
pcl::Hough3DGrouping::use_interpolation_
bool use_interpolation_
Use the interpolation between neighboring Hough bins when casting votes.
Definition: hough_3d.h:461
pcl::CorrespondencesConstPtr
shared_ptr< const Correspondences > CorrespondencesConstPtr
Definition: correspondence.h:91
pcl::Hough3DGrouping::getHoughBinSize
double getHoughBinSize() const
Gets the size of each bin into the Hough space.
Definition: hough_3d.h:307
pcl::Hough3DGrouping::train
bool train()
Call this function after setting the input, the input_rf and the hough_bin_size parameters to perform...
Definition: hough_3d.hpp:84
pcl::recognition::HoughSpace3D
HoughSpace3D is a 3D voting space.
Definition: hough_3d.h:58
pcl::Hough3DGrouping::computeRf
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:54
pcl::Hough3DGrouping::setSceneCloud
void setSceneCloud(const SceneCloudConstPtr &scene) override
Provide a pointer to the scene dataset (i.e.
Definition: hough_3d.h:223
pcl::Hough3DGrouping::SceneRfCloudPtr
typename SceneRfCloud::Ptr SceneRfCloudPtr
Definition: hough_3d.h:157
pcl::Hough3DGrouping
Class implementing a 3D correspondence grouping algorithm that can deal with multiple instances of a ...
Definition: hough_3d.h:149
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition: projection_matrix.h:53
pcl::Hough3DGrouping::setInputRf
void setInputRf(const ModelRfCloudConstPtr &input_rf)
Provide a pointer to the input dataset's reference frames.
Definition: hough_3d.h:199
pcl::Hough3DGrouping::getUseInterpolation
bool getUseInterpolation() const
Gets whether the vote casting procedure interpolates the score between neighboring bins of the Hough ...
Definition: hough_3d.h:330
pcl::PCLBase::setInputCloud
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
Definition: pcl_base.hpp:65
pcl::Hough3DGrouping::PointCloudConstPtr
typename PointCloud::ConstPtr PointCloudConstPtr
Definition: hough_3d.h:162
pcl::Hough3DGrouping::scene_rf_
SceneRfCloudConstPtr scene_rf_
The scene Rf cloud.
Definition: hough_3d.h:446
pcl::Hough3DGrouping::getHoughThreshold
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:286
pcl::Hough3DGrouping::input_rf_
ModelRfCloudConstPtr input_rf_
The input Rf cloud.
Definition: hough_3d.h:443
pcl::Hough3DGrouping::ModelRfCloudConstPtr
typename ModelRfCloud::ConstPtr ModelRfCloudConstPtr
Definition: hough_3d.h:154
pcl::recognition::HoughSpace3D::voter_ids_
std::unordered_map< int, std::vector< int > > voter_ids_
List of voters for each bin.
Definition: hough_3d.h:131
pcl::Hough3DGrouping::houghVoting
bool houghVoting()
The Hough space voting procedure.
Definition: hough_3d.hpp:137
pcl::recognition::HoughSpace3D::bin_count_
Eigen::Vector3i bin_count_
Number of bins for each dimension.
Definition: hough_3d.h:119
pcl::Hough3DGrouping::getLocalRfSearchRadius
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:405
pcl::recognition::HoughSpace3D::min_coord_
Eigen::Vector3d min_coord_
Minimum coordinate in the Hough Space.
Definition: hough_3d.h:113
pcl::Hough3DGrouping::setLocalRfNormalsSearchRadius
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:363
pcl::Hough3DGrouping::needs_training_
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:449
pcl::Hough3DGrouping::local_rf_normals_search_radius_
float local_rf_normals_search_radius_
Normals search radius for the potential Rf calculation.
Definition: hough_3d.h:467
pcl::Hough3DGrouping::hough_bin_size_
double hough_bin_size_
The size of each bin of the hough space.
Definition: hough_3d.h:458
pcl::Hough3DGrouping::hough_space_
pcl::recognition::HoughSpace3D::Ptr hough_space_
The Hough space.
Definition: hough_3d.h:473
pcl::CorrespondenceGrouping::scene_
SceneCloudConstPtr scene_
The scene cloud.
Definition: correspondence_grouping.h:133
pcl::Hough3DGrouping::SceneRfCloudConstPtr
typename SceneRfCloud::ConstPtr SceneRfCloudConstPtr
Definition: hough_3d.h:158
pcl::Hough3DGrouping::setHoughThreshold
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:276
PCL_MAKE_ALIGNED_OPERATOR_NEW
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition: memory.h:63
pcl::Hough3DGrouping::local_rf_search_radius_
float local_rf_search_radius_
Search radius for the potential Rf calculation.
Definition: hough_3d.h:470
pcl::Hough3DGrouping::recognize
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:333
pcl::CorrespondenceGrouping::model_scene_corrs_
CorrespondencesConstPtr model_scene_corrs_
The correspondences between points in the input and the scene datasets.
Definition: correspondence_grouping.h:138
pcl::recognition::HoughSpace3D::bin_size_
Eigen::Vector3d bin_size_
Size of each bin in the Hough Space.
Definition: hough_3d.h:116
pcl::PointCloud::Ptr
shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:429
pcl::CorrespondenceGrouping
Abstract base class for Correspondence Grouping algorithms.
Definition: correspondence_grouping.h:54
pcl::recognition::HoughSpace3D::ConstPtr
shared_ptr< const HoughSpace3D > ConstPtr
Definition: hough_3d.h:65
pcl::Hough3DGrouping::setInputCloud
void setInputCloud(const PointCloudConstPtr &cloud) override
Provide a pointer to the input dataset.
Definition: hough_3d.h:184
pcl::Hough3DGrouping::setLocalRfSearchRadius
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:390
pcl::recognition::HoughSpace3D::hough_space_
std::vector< double > hough_space_
The Hough Space.
Definition: hough_3d.h:128
pcl::Hough3DGrouping::PointCloudPtr
typename PointCloud::Ptr PointCloudPtr
Definition: hough_3d.h:161
pcl::Hough3DGrouping::hough_space_initialized_
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:481
pcl::PointCloud::ConstPtr
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:430
pcl::recognition::HoughSpace3D::total_bins_count_
int total_bins_count_
Total number of bins in the Hough Space.
Definition: hough_3d.h:125
pcl::Hough3DGrouping::setUseInterpolation
void setUseInterpolation(bool use_interpolation)
Sets whether the vote casting procedure interpolates the score between neighboring bins of the Hough ...
Definition: hough_3d.h:318
pcl::Hough3DGrouping::Hough3DGrouping
Hough3DGrouping()
Constructor.
Definition: hough_3d.h:167
pcl::recognition::HoughSpace3D::Ptr
shared_ptr< HoughSpace3D > Ptr
Definition: hough_3d.h:64
pcl::Hough3DGrouping::setSceneRf
void setSceneRf(const SceneRfCloudConstPtr &scene_rf)
Provide a pointer to the scene dataset's reference frames.
Definition: hough_3d.h:237
memory.h
Defines functions, macros and traits for allocating and using memory.
pcl::Hough3DGrouping::getLocalRfNormalsSearchRadius
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:377
pcl::Hough3DGrouping::setUseDistanceWeight
void setUseDistanceWeight(bool use_distance_weight)
Sets whether the vote casting procedure uses the correspondence's distance as a score.
Definition: hough_3d.h:340
pcl::Hough3DGrouping::setHoughBinSize
void setHoughBinSize(double bin_size)
Sets the size of each bin into the Hough space.
Definition: hough_3d.h:296
PCL_EXPORTS
#define PCL_EXPORTS
Definition: pcl_macros.h:331
pcl::Hough3DGrouping::hough_threshold_
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:455