40 #ifndef PCL_RECOGNITION_HOUGH_3D_H_ 41 #define PCL_RECOGNITION_HOUGH_3D_H_ 43 #include <pcl/recognition/cg/correspondence_grouping.h> 44 #include <pcl/recognition/boost.h> 45 #include <pcl/point_types.h> 60 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
68 HoughSpace3D (
const Eigen::Vector3d &min_coord,
const Eigen::Vector3d &bin_size,
const Eigen::Vector3d &max_coord);
82 vote (
const Eigen::Vector3d &single_vote_coord,
double weight,
int voter_id);
92 voteInt (
const Eigen::Vector3d &single_vote_coord,
double weight,
int voter_id);
103 findMaxima (
double min_threshold, std::vector<double> & maxima_values, std::vector<std::vector<int> > &maxima_voter_ids);
117 int partial_bin_products_[4];
144 template<
typename Po
intModelT,
typename Po
intSceneT,
typename Po
intModelRfT = pcl::ReferenceFrame,
typename Po
intSceneRfT = pcl::ReferenceFrame>
166 , needs_training_ (true)
168 , hough_threshold_ (-1)
169 , hough_bin_size_ (1.0)
170 , use_interpolation_ (true)
171 , use_distance_weight_ (false)
172 , local_rf_normals_search_radius_ (0.0f)
173 , local_rf_search_radius_ (0.0f)
175 , found_transformations_ ()
176 , hough_space_initialized_ (false)
186 needs_training_ =
true;
187 hough_space_initialized_ =
false;
200 input_rf_ = input_rf;
201 needs_training_ =
true;
202 hough_space_initialized_ =
false;
211 inline ModelRfCloudConstPtr
225 hough_space_initialized_ =
false;
238 scene_rf_ = scene_rf;
239 hough_space_initialized_ =
false;
248 inline SceneRfCloudConstPtr
263 model_scene_corrs_ = corrs;
264 hough_space_initialized_ =
false;
277 hough_threshold_ = threshold;
287 return (hough_threshold_);
297 hough_bin_size_ = bin_size;
298 hough_space_initialized_ =
false;
308 return (hough_bin_size_);
319 use_interpolation_ = use_interpolation;
320 hough_space_initialized_ =
false;
331 return (use_interpolation_);
341 use_distance_weight_ = use_distance_weight;
342 hough_space_initialized_ =
false;
352 return (use_distance_weight_);
364 local_rf_normals_search_radius_ = local_rf_normals_search_radius;
365 needs_training_ =
true;
366 hough_space_initialized_ =
false;
378 return (local_rf_normals_search_radius_);
391 local_rf_search_radius_ = local_rf_search_radius;
392 needs_training_ =
true;
393 hough_space_initialized_ =
false;
406 return (local_rf_search_radius_);
424 recognize (std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > &transformations);
434 recognize (std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > &transformations, std::vector<pcl::Correspondences> &clustered_corrs);
451 std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> >
model_votes_;
488 clusterCorrespondences (std::vector<Correspondences> &model_instances);
509 template<
typename Po
intType,
typename Po
intRfType>
void 514 #ifdef PCL_NO_PRECOMPILE 515 #include <pcl/recognition/impl/cg/hough_3d.hpp> 518 #endif // PCL_RECOGNITION_HOUGH_3D_H_ boost::unordered_map< int, std::vector< int > > voter_ids_
List of voters for each bin.
Eigen::Vector3i bin_count_
Number of bins for each dimension.
ModelRfCloud::ConstPtr ModelRfCloudConstPtr
std::vector< double > hough_space_
The Hough Space.
float getLocalRfSearchRadius() const
If the Local reference frame has not been set for either the model cloud or the scene cloud...
pcl::PointCloud< PointSceneRfT > SceneRfCloud
float getLocalRfNormalsSearchRadius() const
If the Local reference frame has not been set for either the model cloud or the scene cloud...
int total_bins_count_
Total number of bins in the Hough Space.
void setUseDistanceWeight(bool use_distance_weight)
Sets whether the vote casting procedure uses the correspondence's distance as a score.
void setModelSceneCorrespondences(const CorrespondencesConstPtr &corrs)
Provide a pointer to the precomputed correspondences between points in the input dataset and points i...
SceneRfCloud::Ptr SceneRfCloudPtr
SceneRfCloudConstPtr scene_rf_
The scene Rf cloud.
pcl::PointCloud< PointModelT > PointCloud
double getHoughThreshold() const
Gets the minimum number of votes in the Hough space needed to infer the presence of a model instance ...
SceneRfCloud::ConstPtr SceneRfCloudConstPtr
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...
SceneRfCloudConstPtr getSceneRf() const
Getter for the scene dataset's reference frames.
boost::shared_ptr< pcl::recognition::HoughSpace3D > hough_space_
The Hough space.
float local_rf_normals_search_radius_
Normals search radius for the potential Rf calculation.
bool hough_space_initialized_
Whether the Hough space already contains the correct votes for the current input parameters and so th...
Eigen::Vector3d bin_size_
Size of each bin in the Hough Space.
boost::shared_ptr< PointCloud< PointT > > Ptr
bool use_distance_weight_
Use the weighted correspondence distance when casting votes.
bool getUseDistanceWeight() const
Gets whether the vote casting procedure uses the correspondence's distance as a score.
void setInputRf(const ModelRfCloudConstPtr &input_rf)
Provide a pointer to the input dataset's reference frames.
PointCloud::ConstPtr PointCloudConstPtr
bool needs_training_
If the training of the Hough space is needed; set on change of either the input cloud or the input_rf...
boost::shared_ptr< const Correspondences > CorrespondencesConstPtr
ModelRfCloud::Ptr ModelRfCloudPtr
Hough3DGrouping()
Constructor.
ModelRfCloudConstPtr input_rf_
The input Rf cloud.
void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
pcl::CorrespondenceGrouping< PointModelT, PointSceneT >::SceneCloudConstPtr SceneCloudConstPtr
bool use_interpolation_
Use the interpolation between neighboring Hough bins when casting votes.
Class implementing a 3D correspondence grouping algorithm that can deal with multiple instances of a ...
PointCloud represents the base class in PCL for storing collections of 3D points. ...
void setSceneCloud(const SceneCloudConstPtr &scene)
Provide a pointer to the scene dataset (i.e.
SceneCloud::ConstPtr SceneCloudConstPtr
Abstract base class for Correspondence Grouping algorithms.
float local_rf_search_radius_
Search radius for the potential Rf calculation.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
double hough_threshold_
The minimum number of votes in the Hough space needed to infer the presence of a model instance into ...
void setHoughThreshold(double threshold)
Sets the minimum number of votes in the Hough space needed to infer the presence of a model instance ...
Eigen::Vector3d min_coord_
Minimum coordinate in the Hough Space.
std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > model_votes_
The result of the training.
ModelRfCloudConstPtr getInputRf() const
Getter for the input dataset's reference frames.
pcl::PointCloud< PointModelRfT > ModelRfCloud
std::vector< Eigen::Matrix4f, Eigen::aligned_allocator< Eigen::Matrix4f > > found_transformations_
Transformations found by clusterCorrespondences method.
void setUseInterpolation(bool use_interpolation)
Sets whether the vote casting procedure interpolates the score between neighboring bins of the Hough ...
double hough_bin_size_
The size of each bin of the hough space.
double getHoughBinSize() const
Gets the size of each bin into the Hough space.
HoughSpace3D is a 3D voting space.
bool getUseInterpolation() const
Gets whether the vote casting procedure interpolates the score between neighboring bins of the Hough ...
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...
void setSceneRf(const SceneRfCloudConstPtr &scene_rf)
Provide a pointer to the scene dataset's reference frames.
PointCloud::Ptr PointCloudPtr
void setHoughBinSize(double bin_size)
Sets the size of each bin into the Hough space.