Point Cloud Library (PCL)
1.11.1-dev
|
44 #include <pcl/registration/correspondence_estimation.h>
45 #include <pcl/registration/correspondence_rejection.h>
46 #include <pcl/registration/transformation_estimation.h>
47 #include <pcl/search/kdtree.h>
49 #include <pcl/pcl_base.h>
56 template <
typename Po
intSource,
typename Po
intTarget,
typename Scalar =
float>
59 using Matrix4 = Eigen::Matrix<Scalar, 4, 4>;
66 using Ptr = shared_ptr<Registration<PointSource, PointTarget, Scalar>>;
67 using ConstPtr = shared_ptr<const Registration<PointSource, PointTarget, Scalar>>;
87 TransformationEstimation<PointSource, PointTarget, Scalar>;
104 const std::vector<int>&,
106 const std::vector<int>&);
133 , point_representation_()
250 bool force_no_recompute =
false)
434 point_representation_ = point_representation;
443 std::function<UpdateVisualizerCallbackSignature>& visualizerCallback)
445 if (visualizerCallback) {
457 getFitnessScore(
double max_range = std::numeric_limits<double>::max());
467 const std::vector<float>& distances_b);
492 inline const std::string&
529 inline std::vector<CorrespondenceRejectorPtr>
673 std::vector<int>& indices,
674 std::vector<float>& distances)
676 int k =
tree_->nearestKSearch(cloud, index, 1, indices, distances);
698 PCL_WARN(
"[pcl::registration::Registration] setInputCloud is deprecated."
699 "Please use setInputSource instead.\n");
708 #include <pcl/registration/impl/registration.hpp>
shared_ptr< CorrespondenceRejector > Ptr
bool hasConverged() const
Return the state of convergence after the last align run.
Defines all the PCL and non-PCL macros used.
PointCloudTargetConstPtr target_
The input point cloud dataset target.
void setCorrespondenceEstimation(const CorrespondenceEstimationPtr &ce)
Provide a pointer to the correspondence estimation object.
bool target_cloud_updated_
Variable that stores whether we have a new target cloud, meaning we need to pre-process it again.
CorrespondencesPtr correspondences_
The set of correspondences determined at this ICP step.
void setTransformationEstimation(const TransformationEstimationPtr &te)
Provide a pointer to the transformation estimation object.
virtual void computeTransformation(PointCloudSource &output, const Matrix4 &guess)=0
Abstract transformation computation method with initial guess.
int ransac_iterations_
The number of iterations RANSAC should run for.
std::vector< CorrespondenceRejectorPtr > getCorrespondenceRejectors()
Get the list of correspondence rejectors.
virtual void setInputSource(const PointCloudSourceConstPtr &cloud)
Provide a pointer to the input source (e.g., the point cloud that we want to align to the target)
void addCorrespondenceRejector(const CorrespondenceRejectorPtr &rejector)
Add a new correspondence rejector to the list.
typename CorrespondenceEstimation::ConstPtr CorrespondenceEstimationConstPtr
virtual void setInputTarget(const PointCloudTargetConstPtr &cloud)
Provide a pointer to the input target (e.g., the point cloud that we want to align the input source t...
Registration represents the base registration class for general purpose, ICP-like methods.
void align(PointCloudSource &output)
Call the registration algorithm which estimates the transformation and returns the transformed source...
PointCloudConstPtr input_
The input point cloud dataset.
typename TransformationEstimation::Ptr TransformationEstimationPtr
const PointCloudSourceConstPtr getInputSource()
Get a pointer to the input point cloud dataset target.
bool source_cloud_updated_
Variable that stores whether we have a new source cloud, meaning we need to pre-process it again.
double euclidean_fitness_epsilon_
The maximum allowed Euclidean error between two consecutive steps in the ICP loop,...
typename PointCloudSource::ConstPtr PointCloudSourceConstPtr
double corr_dist_threshold_
The maximum distance threshold between two correspondent points in source <-> target.
double transformation_rotation_epsilon_
The maximum rotation difference between two consecutive transformations in order to consider converge...
int getMaximumIterations()
Get the maximum number of iterations the internal optimization should run for, as set by the user.
double getRANSACOutlierRejectionThreshold()
Get the inlier distance threshold for the internal outlier rejection loop as set by the user.
KdTreeReciprocalPtr getSearchMethodSource() const
Get a pointer to the search method used to find correspondences in the source cloud.
Matrix4 previous_transformation_
The previous transformation matrix estimated by the registration method (used internally).
KdTreePtr tree_
A pointer to the spatial search object.
bool converged_
Holds internal convergence state, given user parameters.
Matrix4 transformation_
The transformation matrix estimated by the registration method.
const std::string & getClassName() const
Abstract class get name method.
int max_iterations_
The maximum number of iterations the internal optimization should run for.
int min_number_correspondences_
The minimum number of correspondences that the algorithm needs before attempting to estimate the tran...
bool initComputeReciprocal()
Internal computation when reciprocal lookup is needed.
double getEuclideanFitnessEpsilon()
Get the maximum allowed distance error before the algorithm will be considered to have converged,...
Eigen::Matrix< float, 4, 4 > Matrix4
bool removeCorrespondenceRejector(unsigned int i)
Remove the i-th correspondence rejector in the list.
shared_ptr< Registration< PointSource, PointTarget, float > > Ptr
Matrix4 final_transformation_
The final transformation matrix estimated by the registration method after N iterations.
shared_ptr< KdTree< PointT, Tree > > Ptr
void setRANSACOutlierRejectionThreshold(double inlier_threshold)
Set the inlier distance threshold for the internal RANSAC outlier rejection loop.
typename CorrespondenceEstimation::Ptr CorrespondenceEstimationPtr
Registration()
Empty constructor.
typename PointCloudSource::Ptr PointCloudSourcePtr
Matrix4 getFinalTransformation()
Get the final transformation matrix estimated by the registration method.
bool registerVisualizationCallback(std::function< UpdateVisualizerCallbackSignature > &visualizerCallback)
Register the user callback function which will be called from registration thread in order to update ...
double transformation_epsilon_
The maximum difference between two consecutive transformations in order to consider convergence (user...
std::function< UpdateVisualizerCallbackSignature > update_visualizer_
Callback function to update intermediate source point cloud position during it's registration to the ...
void setPointRepresentation(const PointRepresentationConstPtr &point_representation)
Provide a boost shared pointer to the PointRepresentation to be used when comparing points.
typename PointCloudTarget::Ptr PointCloudTargetPtr
KdTreePtr getSearchMethodTarget() const
Get a pointer to the search method used to find correspondences in the target cloud.
double getTransformationEpsilon()
Get the transformation epsilon (maximum allowable translation squared difference between two consecut...
bool force_no_recompute_
A flag which, if set, means the tree operating on the target cloud will never be recomputed.
shared_ptr< CorrespondenceEstimationBase< PointSource, PointTarget, Scalar > > Ptr
shared_ptr< const CorrespondenceEstimationBase< PointSource, PointTarget, Scalar > > ConstPtr
typename pcl::registration::TransformationEstimation< PointSource, PointTarget, float > TransformationEstimation
typename PointRepresentation< PointT >::ConstPtr PointRepresentationConstPtr
KdTreeReciprocalPtr tree_reciprocal_
A pointer to the spatial search object of the source.
void(const pcl::PointCloud< PointSource > &, const std::vector< int > &, const pcl::PointCloud< PointTarget > &, const std::vector< int > &) UpdateVisualizerCallbackSignature
The callback signature to the function updating intermediate source point cloud position during it's ...
bool initCompute()
Internal computation initialization.
search::KdTree is a wrapper class which inherits the pcl::KdTree class for performing search function...
~Registration()
destructor.
void setTransformationRotationEpsilon(double epsilon)
Set the transformation rotation epsilon (maximum allowable rotation difference between two consecutiv...
void setMaximumIterations(int nr_iterations)
Set the maximum number of iterations the internal optimization should run for.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
pcl::registration::CorrespondenceRejector::Ptr CorrespondenceRejectorPtr
typename TransformationEstimation::ConstPtr TransformationEstimationConstPtr
std::vector< CorrespondenceRejectorPtr > correspondence_rejectors_
The list of correspondence rejectors to use.
double getTransformationRotationEpsilon()
Get the transformation rotation epsilon (maximum allowable difference between two consecutive transfo...
pcl::PointCloud< PointSource > PointCloudSource
double getRANSACIterations()
Get the number of iterations RANSAC should run for, as set by the user.
const PointCloudTargetConstPtr getInputTarget()
Get a pointer to the input point cloud dataset target.
bool searchForNeighbors(const PointCloudSource &cloud, int index, std::vector< int > &indices, std::vector< float > &distances)
Search for the closest nearest neighbor of a given point.
typename KdTreeReciprocal::Ptr KdTreeReciprocalPtr
shared_ptr< PointCloud< PointSource > > Ptr
typename KdTree::Ptr KdTreePtr
bool force_no_recompute_reciprocal_
A flag which, if set, means the tree operating on the source cloud will never be recomputed.
void setSearchMethodTarget(const KdTreePtr &tree, bool force_no_recompute=false)
Provide a pointer to the search object used to find correspondences in the target cloud.
int nr_iterations_
The number of iterations the internal optimization ran for (used internally).
void setSearchMethodSource(const KdTreeReciprocalPtr &tree, bool force_no_recompute=false)
Provide a pointer to the search object used to find correspondences in the source cloud (usually used...
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)
shared_ptr< const PointCloud< PointSource > > ConstPtr
typename PointCloudTarget::ConstPtr PointCloudTargetConstPtr
std::vector< pcl::Correspondence, Eigen::aligned_allocator< pcl::Correspondence > > Correspondences
TransformationEstimationPtr transformation_estimation_
A TransformationEstimation object, used to calculate the 4x4 rigid transformation.
void setRANSACIterations(int ransac_iterations)
Set the number of iterations RANSAC should run for.
shared_ptr< Correspondences > CorrespondencesPtr
void clearCorrespondenceRejectors()
Clear the list of correspondence rejectors.
void setEuclideanFitnessEpsilon(double epsilon)
Set the maximum allowed Euclidean error between two consecutive steps in the ICP loop,...
Matrix4 getLastIncrementalTransformation()
Get the last incremental transformation matrix estimated by the registration method.
void setMaxCorrespondenceDistance(double distance_threshold)
Set the maximum distance threshold between two correspondent points in source <-> target.
Defines functions, macros and traits for allocating and using memory.
typename KdTree::PointRepresentationConstPtr PointRepresentationConstPtr
double getMaxCorrespondenceDistance()
Get the maximum distance threshold between two correspondent points in source <-> target.
std::string reg_name_
The registration method name.
shared_ptr< const Registration< PointSource, PointTarget, float > > ConstPtr
CorrespondenceEstimationPtr correspondence_estimation_
A CorrespondenceEstimation object, used to estimate correspondences between the source and the target...
void setTransformationEpsilon(double epsilon)
Set the transformation epsilon (maximum allowable translation squared difference between two consecut...
double inlier_threshold_
The inlier distance threshold for the internal RANSAC outlier rejection loop.