43 #include <pcl/registration/registration.h>
44 #include <pcl/registration/transformation_estimation_svd.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.
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
float operator()(float e) const override
HuberPenalty(float threshold)
TruncatedError(float threshold)
float operator()(float e) const override
~TruncatedError() override=default
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
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...
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.
pcl::index_t getRandomIndex(int n)
Choose a random index between 0 and n-1.
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.
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::Ptr PointCloudSourcePtr
int getCorrespondenceRandomness()
Get the number of neighbors used when selecting a random feature correspondence, as set by the user.
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...
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.
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
IndicesAllocator<> Indices
Type used for indices in PCL.
shared_ptr< ::pcl::PointIndices > Ptr
shared_ptr< const ::pcl::PointIndices > ConstPtr