45 #include <pcl/registration/registration.h>
46 #include <pcl/registration/transformation_estimation_svd.h>
55 template <
typename Po
intSource,
typename Po
intTarget,
typename FeatureT>
86 using Ptr = shared_ptr<SampleConsensusInitialAlignment<PointSource, PointTarget, FeatureT> >;
87 using ConstPtr = shared_ptr<const SampleConsensusInitialAlignment<PointSource, PointTarget, FeatureT> >;
93 using Ptr = shared_ptr<ErrorFunctor>;
94 using ConstPtr = shared_ptr<const ErrorFunctor>;
144 reg_name_ =
"SampleConsensusInitialAlignment";
221 getRandomIndex (
int n) {
return (
static_cast<int> (n * (rand () / (RAND_MAX + 1.0)))); };
232 std::vector<int> &sample_indices);
243 std::vector<int> &corresponding_indices);
283 #include <pcl/registration/impl/ia_ransac.hpp>
KdTreeFLANN is a generic type of 3D spatial locator using kD-tree structures.
shared_ptr< PointCloud< FeatureT > > Ptr
shared_ptr< const PointCloud< FeatureT > > ConstPtr
Registration represents the base registration class for general purpose, ICP-like methods.
double corr_dist_threshold_
The maximum distance threshold between two correspondent points in source <-> target.
std::string reg_name_
The registration method name.
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.
virtual float operator()(float d) const =0
shared_ptr< const ErrorFunctor > ConstPtr
virtual ~ErrorFunctor()=default
shared_ptr< ErrorFunctor > Ptr
HuberPenalty(float threshold)
virtual float operator()(float e) const
TruncatedError(float threshold)
float operator()(float e) const override
SampleConsensusInitialAlignment is an implementation of the initial alignment algorithm described in ...
FeatureCloudConstPtr const getTargetFeatures()
Get a pointer to the target point cloud's features.
PointIndices::ConstPtr PointIndicesConstPtr
void computeTransformation(PointCloudSource &output, const Eigen::Matrix4f &guess) override
Rigid transformation computation method.
shared_ptr< const SampleConsensusInitialAlignment< PointSource, PointTarget, FeatureT > > ConstPtr
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...
int getNumberOfSamples()
Get the number of samples to use during each iteration, as set by the user.
PointIndices::Ptr PointIndicesPtr
float computeErrorMetric(const PointCloudSource &cloud, float threshold)
An error metric for that computes the quality of the alignment between the given cloud and the target...
int getRandomIndex(int n)
Choose a random index between 0 and n-1.
typename PointCloudSource::ConstPtr PointCloudSourceConstPtr
void setMinSampleDistance(float min_sample_distance)
Set the minimum distances between samples.
typename Registration< PointSource, PointTarget >::PointCloudSource PointCloudSource
FeatureKdTreePtr feature_tree_
The KdTree used to compare feature descriptors.
void selectSamples(const PointCloudSource &cloud, int nr_samples, float min_sample_distance, std::vector< int > &sample_indices)
Select nr_samples sample points from cloud while making sure that their pairwise distances are greate...
pcl::PointCloud< FeatureT > FeatureCloud
void setTargetFeatures(const FeatureCloudConstPtr &features)
Provide a shared pointer to the target point cloud's feature descriptors.
typename KdTreeFLANN< FeatureT >::Ptr FeatureKdTreePtr
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.
float getMinSampleDistance()
Get the minimum distances between samples, as set by the user.
shared_ptr< SampleConsensusInitialAlignment< PointSource, PointTarget, FeatureT > > Ptr
float min_sample_distance_
The minimum distances between samples.
typename ErrorFunctor::Ptr ErrorFunctorPtr
typename FeatureCloud::Ptr FeatureCloudPtr
void setErrorFunction(const ErrorFunctorPtr &error_functor)
Specify the error function to minimize.
FeatureCloudConstPtr input_features_
The source point cloud's feature descriptors.
int nr_samples_
The number of samples to use during each iteration.
typename PointCloudSource::Ptr PointCloudSourcePtr
int getCorrespondenceRandomness()
Get the number of neighbors used when selecting a random feature correspondence, as set by the user.
void setCorrespondenceRandomness(int k)
Set the number of neighbors to use when selecting a random feature correspondence.
typename FeatureCloud::ConstPtr FeatureCloudConstPtr
SampleConsensusInitialAlignment()
Constructor.
int k_correspondences_
The number of neighbors to use when selecting a random feature correspondence.
ErrorFunctorPtr error_functor_
ErrorFunctorPtr getErrorFunction()
Get a shared pointer to the ErrorFunctor that is to be minimized
FeatureCloudConstPtr const getSourceFeatures()
Get a pointer to the source point cloud's features.
typename Registration< PointSource, PointTarget >::PointCloudTarget PointCloudTarget
void setSourceFeatures(const FeatureCloudConstPtr &features)
Provide a shared pointer to the source point cloud's feature descriptors.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Defines functions, macros and traits for allocating and using memory.
Defines all the PCL and non-PCL macros used.
shared_ptr< ::pcl::PointIndices > Ptr
shared_ptr< const ::pcl::PointIndices > ConstPtr