43#include <pcl/registration/correspondence_rejection_poly.h>
44#include <pcl/registration/registration.h>
45#include <pcl/registration/transformation_estimation_svd.h>
46#include <pcl/registration/transformation_validation.h>
74template <
typename Po
intSource,
typename Po
intTarget,
typename FeatureT>
108 shared_ptr<SampleConsensusPrerejective<PointSource, PointTarget, FeatureT>>;
110 shared_ptr<const SampleConsensusPrerejective<PointSource, PointTarget, FeatureT>>;
130 reg_name_ =
"SampleConsensusPrerejective";
256 return (
static_cast<int>(n * (rand() / (RAND_MAX + 1.0))));
279 std::vector<pcl::Indices>& similar_features,
288 const Eigen::Matrix4f& guess)
override;
329#include <pcl/registration/impl/sample_consensus_prerejective.hpp>
KdTreeFLANN is a generic type of 3D spatial locator using kD-tree structures.
shared_ptr< KdTreeFLANN< PointT, Dist > > Ptr
PointCloudConstPtr input_
The input point cloud dataset.
shared_ptr< PointCloud< FeatureT > > Ptr
shared_ptr< const PointCloud< FeatureT > > ConstPtr
Registration represents the base registration class for general purpose, ICP-like methods.
Matrix4 final_transformation_
The final transformation matrix estimated by the registration method after N iterations.
double corr_dist_threshold_
The maximum distance threshold between two correspondent points in source <-> target.
std::string reg_name_
The registration method name.
Matrix4 transformation_
The transformation matrix estimated by the registration method.
KdTreePtr tree_
A pointer to the spatial search object.
bool converged_
Holds internal convergence state, given user parameters.
Eigen::Matrix< Scalar, 4, 4 > Matrix4
TransformationEstimationPtr transformation_estimation_
A TransformationEstimation object, used to calculate the 4x4 rigid transformation.
int max_iterations_
The maximum number of iterations the internal optimization should run for.
double getFitnessScore(double max_range=std::numeric_limits< double >::max())
Obtain the Euclidean fitness score (e.g., mean of squared distances from the source to the target)
PointCloudTargetConstPtr target_
The input point cloud dataset target.
const std::string & getClassName() const
Abstract class get name method.
Pose estimation and alignment class using a prerejective RANSAC routine.
float getSimilarityThreshold() const
Get the similarity threshold between edge lengths of the underlying polygonal correspondence rejector...
shared_ptr< SampleConsensusPrerejective< PointSource, PointTarget, FeatureT > > Ptr
typename Registration< PointSource, PointTarget >::PointCloudTarget PointCloudTarget
float inlier_fraction_
The fraction [0,1] of inlier points required for accepting a transformation.
typename PointCloudSource::ConstPtr PointCloudSourceConstPtr
pcl::Indices inliers_
Inlier points of final transformation as indices into source.
float getInlierFraction() const
Get the required inlier fraction.
void setCorrespondenceRandomness(int k)
Set the number of neighbors to use when selecting a random feature correspondence.
SampleConsensusPrerejective()
Constructor.
const FeatureCloudConstPtr getSourceFeatures() const
Get a pointer to the source point cloud's features.
FeatureCloudConstPtr input_features_
The source point cloud's feature descriptors.
FeatureKdTreePtr feature_tree_
The KdTree used to compare feature descriptors.
void setTargetFeatures(const FeatureCloudConstPtr &features)
Provide a boost shared pointer to the target point cloud's feature descriptors.
void setInlierFraction(float inlier_fraction)
Set the required inlier fraction (of the input)
CorrespondenceRejectorPolyPtr correspondence_rejector_poly_
The polygonal correspondence rejector used for prerejection.
void computeTransformation(PointCloudSource &output, const Eigen::Matrix4f &guess) override
Rigid transformation computation method.
int getCorrespondenceRandomness() const
Get the number of neighbors used when selecting a random feature correspondence, as set by the user.
typename CorrespondenceRejectorPoly::ConstPtr CorrespondenceRejectorPolyConstPtr
const FeatureCloudConstPtr getTargetFeatures() const
Get a pointer to the target point cloud's features.
typename Registration< PointSource, PointTarget >::PointCloudSource PointCloudSource
typename FeatureCloud::ConstPtr FeatureCloudConstPtr
PointIndices::Ptr PointIndicesPtr
typename PointCloudSource::Ptr PointCloudSourcePtr
PointIndices::ConstPtr PointIndicesConstPtr
void setSimilarityThreshold(float similarity_threshold)
Set the similarity threshold in [0,1[ between edge lengths of the underlying polygonal correspondence...
void findSimilarFeatures(const pcl::Indices &sample_indices, std::vector< pcl::Indices > &similar_features, pcl::Indices &corresponding_indices)
For each of the sample points, find a list of points in the target cloud whose features are similar t...
~SampleConsensusPrerejective()
Destructor.
void setSourceFeatures(const FeatureCloudConstPtr &features)
Provide a boost shared pointer to the source point cloud's feature descriptors.
FeatureCloudConstPtr target_features_
The target point cloud's feature descriptors.
void setNumberOfSamples(int nr_samples)
Set the number of samples to use during each iteration.
typename FeatureCloud::Ptr FeatureCloudPtr
typename KdTreeFLANN< FeatureT >::Ptr FeatureKdTreePtr
int getNumberOfSamples() const
Get the number of samples to use during each iteration, as set by the user.
void selectSamples(const PointCloudSource &cloud, int nr_samples, pcl::Indices &sample_indices)
Select nr_samples sample points from cloud while making sure that their pairwise distances are greate...
int getRandomIndex(int n) const
Choose a random index between 0 and n-1.
const pcl::Indices & getInliers() const
Get the inlier indices of the source point cloud under the final transformation.
int nr_samples_
The number of samples to use during each iteration.
typename Registration< PointSource, PointTarget >::Matrix4 Matrix4
typename CorrespondenceRejectorPoly::Ptr CorrespondenceRejectorPolyPtr
shared_ptr< const SampleConsensusPrerejective< PointSource, PointTarget, FeatureT > > ConstPtr
int k_correspondences_
The number of neighbors to use when selecting a random feature correspondence.
void getFitness(pcl::Indices &inliers, float &fitness_score)
Obtain the fitness of a transformation The following metrics are calculated, based on final_transform...
CorrespondenceRejectorPoly implements a correspondence rejection method that exploits low-level and p...
shared_ptr< const CorrespondenceRejectorPoly< SourceT, TargetT > > ConstPtr
shared_ptr< CorrespondenceRejectorPoly< SourceT, TargetT > > Ptr
IndicesAllocator<> Indices
Type used for indices in PCL.
shared_ptr< ::pcl::PointIndices > Ptr
shared_ptr< const ::pcl::PointIndices > ConstPtr