41 #ifndef PCL_REGISTRATION_SAMPLE_CONSENSUS_PREREJECTIVE_H_
42 #define PCL_REGISTRATION_SAMPLE_CONSENSUS_PREREJECTIVE_H_
44 #include <pcl/registration/registration.h>
45 #include <pcl/registration/transformation_estimation_svd.h>
46 #include <pcl/registration/transformation_validation.h>
47 #include <pcl/registration/correspondence_rejection_poly.h>
76 template <
typename Po
intSource,
typename Po
intTarget,
typename FeatureT>
108 typedef boost::shared_ptr<SampleConsensusPrerejective<PointSource, PointTarget, FeatureT> >
Ptr;
109 typedef boost::shared_ptr<const SampleConsensusPrerejective<PointSource, PointTarget, FeatureT> >
ConstPtr;
127 reg_name_ =
"SampleConsensusPrerejective";
237 inline const std::vector<int>&
250 return (static_cast<int> (n * (rand () / (RAND_MAX + 1.0))));
261 std::vector<int> &sample_indices);
272 std::vector<int> &corresponding_indices);
289 getFitness (std::vector<int>& inliers,
float& fitness_score);
317 #include <pcl/registration/impl/sample_consensus_prerejective.hpp>
virtual ~SampleConsensusPrerejective()
Destructor.
CorrespondenceRejectorPolyPtr correspondence_rejector_poly_
The polygonal correspondence rejector used for prerejection.
PointCloudSource::Ptr PointCloudSourcePtr
boost::shared_ptr< SampleConsensusPrerejective< PointSource, PointTarget, FeatureT > > Ptr
float getSimilarityThreshold() const
Get the similarity threshold between edge lengths of the underlying polygonal correspondence rejector...
void setSimilarityThreshold(float similarity_threshold)
Set the similarity threshold in [0,1[ between edge lengths of the underlying polygonal correspondence...
Registration represents the base registration class for general purpose, ICP-like methods...
const FeatureCloudConstPtr getTargetFeatures() const
Get a pointer to the target point cloud's features.
TransformationEstimationPtr transformation_estimation_
A TransformationEstimation object, used to calculate the 4x4 rigid transformation.
SampleConsensusPrerejective()
Constructor.
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
PointIndices::Ptr PointIndicesPtr
boost::shared_ptr< const CorrespondenceRejectorPoly > ConstPtr
Registration< PointSource, PointTarget >::Matrix4 Matrix4
void setSourceFeatures(const FeatureCloudConstPtr &features)
Provide a boost shared pointer to the source point cloud's feature descriptors.
void setCorrespondenceRandomness(int k)
Set the number of neighbors to use when selecting a random feature correspondence.
boost::shared_ptr< PointCloud< PointT > > Ptr
float inlier_fraction_
The fraction [0,1] of inlier points required for accepting a transformation.
KdTreeFLANN< FeatureT >::Ptr FeatureKdTreePtr
float getInlierFraction() const
Get the required inlier fraction.
int nr_samples_
The number of samples to use during each iteration.
int k_correspondences_
The number of neighbors to use when selecting a random feature correspondence.
std::vector< int > inliers_
Inlier points of final transformation as indices into source.
PointIndices::ConstPtr PointIndicesConstPtr
void setInlierFraction(float inlier_fraction)
Set the required inlier fraction (of the input)
CorrespondenceRejectorPoly::ConstPtr CorrespondenceRejectorPolyConstPtr
int getRandomIndex(int n) const
Choose a random index between 0 and n-1.
KdTreeFLANN is a generic type of 3D spatial locator using kD-tree structures.
boost::shared_ptr< const SampleConsensusPrerejective< PointSource, PointTarget, FeatureT > > ConstPtr
TransformationEstimationSVD implements SVD-based estimation of the transformation aligning the given ...
boost::shared_ptr< CorrespondenceRejectorPoly > Ptr
FeatureCloud::ConstPtr FeatureCloudConstPtr
void setNumberOfSamples(int nr_samples)
Set the number of samples to use during each iteration.
void computeTransformation(PointCloudSource &output, const Eigen::Matrix4f &guess)
Rigid transformation computation method.
FeatureKdTreePtr feature_tree_
The KdTree used to compare feature descriptors.
boost::shared_ptr< ::pcl::PointIndices > Ptr
Registration< PointSource, PointTarget >::PointCloudSource PointCloudSource
void selectSamples(const PointCloudSource &cloud, int nr_samples, std::vector< int > &sample_indices)
Select nr_samples sample points from cloud while making sure that their pairwise distances are greate...
CorrespondenceRejectorPoly implements a correspondence rejection method that exploits low-level and p...
int getCorrespondenceRandomness() const
Get the number of neighbors used when selecting a random feature correspondence, as set by the user...
const FeatureCloudConstPtr getSourceFeatures() const
Get a pointer to the source point cloud's features.
pcl::PointCloud< FeatureT > FeatureCloud
PointCloudSource::ConstPtr PointCloudSourceConstPtr
void getFitness(std::vector< int > &inliers, float &fitness_score)
Obtain the fitness of a transformation The following metrics are calculated, based on final_transform...
std::string reg_name_
The registration method name.
Pose estimation and alignment class using a prerejective RANSAC routine.
Registration< PointSource, PointTarget >::PointCloudTarget PointCloudTarget
int getNumberOfSamples() const
Get the number of samples to use during each iteration, as set by the user.
void findSimilarFeatures(const FeatureCloud &input_features, const std::vector< int > &sample_indices, std::vector< int > &corresponding_indices)
For each of the sample points, find a list of points in the target cloud whose features are similar t...
CorrespondenceRejectorPoly::Ptr CorrespondenceRejectorPolyPtr
FeatureCloudConstPtr input_features_
The source point cloud's feature descriptors.
boost::shared_ptr< ::pcl::PointIndices const > ConstPtr
FeatureCloudConstPtr target_features_
The target point cloud's feature descriptors.
pcl::registration::CorrespondenceRejectorPoly< PointSource, PointTarget > CorrespondenceRejectorPoly
const std::vector< int > & getInliers() const
Get the inlier indices of the source point cloud under the final transformation.
int max_iterations_
The maximum number of iterations the internal optimization should run for.
void setTargetFeatures(const FeatureCloudConstPtr &features)
Provide a boost shared pointer to the target point cloud's feature descriptors.
FeatureCloud::Ptr FeatureCloudPtr