43 #include <pcl/registration/registration.h> 44 #include <pcl/features/ppf.h> 46 #include <unordered_map> 58 struct HashKeyStruct :
public std::pair <int, std::pair <int, std::pair <int, int> > >
65 this->second.first = b;
66 this->second.second.first = c;
67 this->second.second.second = d;
72 const std::size_t h1 = std::hash<int>{} (s.first);
73 const std::size_t h2 = std::hash<int>{} (s.second.first);
74 const std::size_t h3 = std::hash<int>{} (s.second.second.first);
75 const std::size_t h4 = std::hash<int>{} (s.second.second.second);
76 return h1 ^ (h2 << 1) ^ (h3 << 2) ^ (h4 << 3);
81 using Ptr = shared_ptr<PPFHashMapSearch>;
82 using ConstPtr = shared_ptr<const PPFHashMapSearch>;
90 float distance_discretization_step = 0.01f)
92 , internals_initialized_ (false)
93 , angle_discretization_step_ (angle_discretization_step)
94 , distance_discretization_step_ (distance_discretization_step)
114 nearestNeighborSearch (
float &f1,
float &f2,
float &f3,
float &f4,
115 std::vector<std::pair<std::size_t, std::size_t> > &indices);
136 bool internals_initialized_;
138 float angle_discretization_step_, distance_discretization_step_;
153 template <
typename Po
intSource,
typename Po
intTarget>
193 scene_reference_point_sampling_rate_ (5),
194 clustering_position_diff_threshold_ (0.01f),
195 clustering_rotation_diff_threshold_ (20.0f / 180.0f * static_cast<float> (
M_PI))
256 computeTransformation (
PointCloudSource &output,
const Eigen::Matrix4f& guess)
override;
263 unsigned int scene_reference_point_sampling_rate_;
267 float clustering_position_diff_threshold_, clustering_rotation_diff_threshold_;
275 poseWithVotesCompareFunction (
const PoseWithVotes &a,
276 const PoseWithVotes &b);
281 clusterVotesCompareFunction (
const std::pair<std::size_t, unsigned int> &a,
282 const std::pair<std::size_t, unsigned int> &b);
293 posesWithinErrorBounds (Eigen::Affine3f &pose1,
294 Eigen::Affine3f &pose2);
298 #include <pcl/registration/impl/ppf_registration.hpp> std::size_t operator()(const HashKeyStruct &s) const noexcept
shared_ptr< PointCloud< PointSource > > Ptr
PoseWithVotes(Eigen::Affine3f &a_pose, unsigned int &a_votes)
Ptr makeShared()
Convenience method for returning a copy of the class instance as a shared_ptr.
typename PointCloudTarget::Ptr PointCloudTargetPtr
std::vector< PoseWithVotes, Eigen::aligned_allocator< PoseWithVotes > > PoseWithVotesList
PPFHashMapSearch::Ptr getSearchMethod()
Getter function for the search method of the class.
void setRotationClusteringThreshold(float clustering_rotation_diff_threshold)
Method for setting the rotation clustering parameter.
std::unordered_multimap< HashKeyStruct, std::pair< std::size_t, std::size_t >, HashKeyStruct > FeatureHashMapType
void setSceneReferencePointSamplingRate(unsigned int scene_reference_point_sampling_rate)
Method for setting the scene reference point sampling rate.
pcl::PointCloud< PointSource > PointCloudSource
std::vector< std::vector< float > > alpha_m_
void setPositionClusteringThreshold(float clustering_position_diff_threshold)
Method for setting the position difference clustering parameter.
shared_ptr< PPFHashMapSearch > Ptr
typename PointCloudSource::Ptr PointCloudSourcePtr
float getModelDiameter() const
Returns the maximum distance found between any feature pair in the given input feature cloud...
shared_ptr< FeatureHashMapType > FeatureHashMapTypePtr
void setInputTarget(const PointCloudTargetConstPtr &cloud) override
Provide a pointer to the input target (e.g., the point cloud that we want to align the input source t...
typename PointCloudSource::ConstPtr PointCloudSourceConstPtr
void setSearchMethod(PPFHashMapSearch::Ptr search_method)
Function that sets the search method for the algorithm.
float getRotationClusteringThreshold()
Returns the parameter defining the rotation clustering threshold.
PPFHashMapSearch(float angle_discretization_step=12.0f/180.0f *static_cast< float >(M_PI), float distance_discretization_step=0.01f)
Constructor for the PPFHashMapSearch class which sets the two step parameters for the enclosed data s...
typename PointCloudTarget::ConstPtr PointCloudTargetConstPtr
shared_ptr< const PPFHashMapSearch > ConstPtr
float getAngleDiscretizationStep() const
Returns the angle discretization step parameter (the step value between each bin of the hash map for ...
Registration represents the base registration class for general purpose, ICP-like methods...
unsigned int getSceneReferencePointSamplingRate()
Returns the parameter for the scene reference point sampling rate of the algorithm.
float getPositionClusteringThreshold()
Returns the parameter defining the position difference clustering parameter - distance threshold belo...
float getDistanceDiscretizationStep() const
Returns the distance discretization step parameter (the step value between each bin of the hash map f...
Structure for storing a pose (represented as an Eigen::Affine3f) and an integer for counting votes...
shared_ptr< const PointCloud< PointT > > ConstPtr
Class that registers two point clouds based on their sets of PPFSignatures.
PPFRegistration()
Empty constructor that initializes all the parameters of the algorithm with default values...
HashKeyStruct(int a, int b, int c, int d)
Data structure to hold the information for the key in the feature hash map of the PPFHashMapSearch cl...
shared_ptr< KdTreeFLANN< PointT, Dist > > Ptr