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