43 #include <pcl/registration/registration.h>
44 #include <pcl/registration/transformation_estimation_svd.h>
45 #include <pcl/memory.h>
53 template <
typename Po
intSource,
typename Po
intTarget,
typename FeatureT>
86 shared_ptr<SampleConsensusInitialAlignment<PointSource, PointTarget, FeatureT>>;
92 using Ptr = shared_ptr<ErrorFunctor>;
93 using ConstPtr = shared_ptr<const ErrorFunctor>;
110 return (0.5 * e * e);
148 reg_name_ =
"SampleConsensusInitialAlignment";
264 return (static_cast<pcl::index_t>(n * (rand() / (RAND_MAX + 1.0))));
275 unsigned int nr_samples,
276 float min_sample_distance,
304 const Eigen::Matrix4f& guess)
override;
332 #include <pcl/registration/impl/ia_ransac.hpp>
KdTreeFLANN is a generic type of 3D spatial locator using kD-tree structures.
void setCorrespondenceRandomness(int k)
Set the number of neighbors to use when selecting a random feature correspondence.
int nr_samples_
The number of samples to use during each iteration.
shared_ptr< PointCloud< FeatureT > > Ptr
shared_ptr< const SampleConsensusInitialAlignment< PointSource, PointTarget, FeatureT >> ConstPtr
typename KdTreeFLANN< FeatureT >::Ptr FeatureKdTreePtr
TransformationEstimationPtr transformation_estimation_
A TransformationEstimation object, used to calculate the 4x4 rigid transformation.
virtual float operator()(float d) const =0
PointIndices::ConstPtr PointIndicesConstPtr
FeatureKdTreePtr feature_tree_
The KdTree used to compare feature descriptors.
void setNumberOfSamples(int nr_samples)
Set the number of samples to use during each iteration.
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
float operator()(float e) const override
pcl::PointCloud< FeatureT > FeatureCloud
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
void findSimilarFeatures(const FeatureCloud &input_features, const pcl::Indices &sample_indices, pcl::Indices &corresponding_indices)
For each of the sample points, find a list of points in the target cloud whose features are similar t...
HuberPenalty(float threshold)
void setTargetFeatures(const FeatureCloudConstPtr &features)
Provide a shared pointer to the target point cloud's feature descriptors.
void setSourceFeatures(const FeatureCloudConstPtr &features)
Provide a shared pointer to the source point cloud's feature descriptors.
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...
shared_ptr< ::pcl::PointIndices > Ptr
SampleConsensusInitialAlignment()
Constructor.
FeatureCloudConstPtr target_features_
The target point cloud's feature descriptors.
int k_correspondences_
The number of neighbors to use when selecting a random feature correspondence.
int max_iterations_
The maximum number of iterations the internal optimization should run for.
typename ErrorFunctor::Ptr ErrorFunctorPtr
FeatureCloudConstPtr const getTargetFeatures()
Get a pointer to the target point cloud's features.
ErrorFunctorPtr getErrorFunction()
Get a shared pointer to the ErrorFunctor that is to be minimized.
void selectSamples(const PointCloudSource &cloud, unsigned int nr_samples, float min_sample_distance, pcl::Indices &sample_indices)
Select nr_samples sample points from cloud while making sure that their pairwise distances are greate...
typename PointCloudSource::ConstPtr PointCloudSourceConstPtr
~TruncatedError() override=default
int getCorrespondenceRandomness()
Get the number of neighbors used when selecting a random feature correspondence, as set by the user...
shared_ptr< const ErrorFunctor > ConstPtr
typename FeatureCloud::Ptr FeatureCloudPtr
IndicesAllocator<> Indices
Type used for indices in PCL.
Registration represents the base registration class for general purpose, ICP-like methods...
ErrorFunctorPtr error_functor_
typename PointCloudSource::Ptr PointCloudSourcePtr
shared_ptr< SampleConsensusInitialAlignment< PointSource, PointTarget, FeatureT >> Ptr
SampleConsensusInitialAlignment is an implementation of the initial alignment algorithm described in ...
shared_ptr< ErrorFunctor > Ptr
void setErrorFunction(const ErrorFunctorPtr &error_functor)
Specify the error function to minimize.
typename Registration< PointSource, PointTarget >::PointCloudSource PointCloudSource
FeatureCloudConstPtr const getSourceFeatures()
Get a pointer to the source point cloud's features.
shared_ptr< const ::pcl::PointIndices > ConstPtr
typename Registration< PointSource, PointTarget >::PointCloudTarget PointCloudTarget
FeatureCloudConstPtr input_features_
The source point cloud's feature descriptors.
shared_ptr< const PointCloud< FeatureT > > ConstPtr
int getNumberOfSamples()
Get the number of samples to use during each iteration, as set by the user.
std::string reg_name_
The registration method name.
PointIndices::Ptr PointIndicesPtr
float min_sample_distance_
The minimum distances between samples.
double corr_dist_threshold_
The maximum distance threshold between two correspondent points in source <-> target.
virtual ~ErrorFunctor()=default
void computeTransformation(PointCloudSource &output, const Eigen::Matrix4f &guess) override
Rigid transformation computation method.
float getMinSampleDistance()
Get the minimum distances between samples, as set by the user.
typename FeatureCloud::ConstPtr FeatureCloudConstPtr
pcl::index_t getRandomIndex(int n)
Choose a random index between 0 and n-1.
TruncatedError(float threshold)
void setMinSampleDistance(float min_sample_distance)
Set the minimum distances between samples.
float operator()(float e) const override