43 #include <pcl/registration/registration.h> 44 #include <pcl/registration/transformation_estimation_svd.h> 53 template <
typename Po
intSource,
typename Po
intTarget,
typename FeatureT>
84 typedef boost::shared_ptr<SampleConsensusInitialAlignment<PointSource, PointTarget, FeatureT> >
Ptr;
85 typedef boost::shared_ptr<const SampleConsensusInitialAlignment<PointSource, PointTarget, FeatureT> >
ConstPtr;
106 return (0.5 * threshold_ * (2.0 * fabs (e) - threshold_));
123 return (e / threshold_);
139 reg_name_ =
"SampleConsensusInitialAlignment";
154 inline FeatureCloudConstPtr
const 164 inline FeatureCloudConstPtr
const 208 boost::shared_ptr<ErrorFunctor>
216 getRandomIndex (
int n) {
return (static_cast<int> (n * (rand () / (RAND_MAX + 1.0)))); };
226 selectSamples (
const PointCloudSource &cloud,
int nr_samples,
float min_sample_distance,
227 std::vector<int> &sample_indices);
237 findSimilarFeatures (
const FeatureCloud &input_features,
const std::vector<int> &sample_indices,
238 std::vector<int> &corresponding_indices);
275 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
279 #include <pcl/registration/impl/ia_ransac.hpp> 281 #endif //#ifndef IA_RANSAC_H_ 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.
PointCloudSource::ConstPtr PointCloudSourceConstPtr
TransformationEstimationPtr transformation_estimation_
A TransformationEstimation object, used to calculate the 4x4 rigid transformation.
FeatureKdTreePtr feature_tree_
The KdTree used to compare feature descriptors.
boost::shared_ptr< ErrorFunctor > error_functor_
void setNumberOfSamples(int nr_samples)
Set the number of samples to use during each iteration.
PointCloudSource::Ptr PointCloudSourcePtr
void setErrorFunction(const boost::shared_ptr< ErrorFunctor > &error_functor)
Specify the error function to minimize.
HuberPenalty(float threshold)
virtual float operator()(float d) const =0
void setTargetFeatures(const FeatureCloudConstPtr &features)
Provide a boost shared pointer to the target point cloud's feature descriptors.
void setSourceFeatures(const FeatureCloudConstPtr &features)
Provide a boost shared pointer to the source point cloud's feature descriptors.
boost::shared_ptr< PointCloud< FeatureT > > Ptr
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...
SampleConsensusInitialAlignment()
Constructor.
boost::shared_ptr< SampleConsensusInitialAlignment< PointSource, PointTarget, FeatureT > > Ptr
FeatureCloud::Ptr FeatureCloudPtr
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.
boost::shared_ptr< ErrorFunctor > getErrorFunction()
Get a shared pointer to the ErrorFunctor that is to be minimized.
int max_iterations_
The maximum number of iterations the internal optimization should run for.
FeatureCloudConstPtr const getTargetFeatures()
Get a pointer to the target point cloud's features.
pcl::PointCloud< FeatureT > FeatureCloud
int getCorrespondenceRandomness()
Get the number of neighbors used when selecting a random feature correspondence, as set by the user...
Registration< PointSource, PointTarget >::PointCloudSource PointCloudSource
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
Registration represents the base registration class for general purpose, ICP-like methods...
boost::shared_ptr< ::pcl::PointIndices > Ptr
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...
PointIndices::Ptr PointIndicesPtr
virtual void computeTransformation(PointCloudSource &output, const Eigen::Matrix4f &guess)
Rigid transformation computation method.
SampleConsensusInitialAlignment is an implementation of the initial alignment algorithm described in ...
FeatureCloudConstPtr const getSourceFeatures()
Get a pointer to the source point cloud's features.
FeatureCloudConstPtr input_features_
The source point cloud's feature descriptors.
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...
FeatureCloud::ConstPtr FeatureCloudConstPtr
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.
float min_sample_distance_
The minimum distances between samples.
double corr_dist_threshold_
The maximum distance threshold between two correspondent points in source <-> target.
float getMinSampleDistance()
Get the minimum distances between samples, as set by the user.
KdTreeFLANN< FeatureT >::Ptr FeatureKdTreePtr
virtual ~TruncatedError()
TruncatedError(float threshold)
void setMinSampleDistance(float min_sample_distance)
Set the minimum distances between samples.
boost::shared_ptr< const SampleConsensusInitialAlignment< PointSource, PointTarget, FeatureT > > ConstPtr
boost::shared_ptr< ::pcl::PointIndices const > ConstPtr
PointIndices::ConstPtr PointIndicesConstPtr
int getRandomIndex(int n)
Choose a random index between 0 and n-1.
Registration< PointSource, PointTarget >::PointCloudTarget PointCloudTarget