Loading...
Searching...
No Matches
registration.h
/*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2010-2011, Willow Garage, Inc.
* Copyright (c) 2012-, Open Perception, Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the copyright holder(s) nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*
*/
#pragma once
// PCL includes
#include <pcl/registration/correspondence_estimation.h>
#include <pcl/registration/correspondence_rejection.h>
#include <pcl/registration/transformation_estimation.h>
#include <pcl/search/kdtree.h>
#include <pcl/memory.h>
#include <pcl/pcl_base.h>
#include <pcl/pcl_macros.h>
namespace pcl {
/** \brief @b Registration represents the base registration class for general purpose,
* ICP-like methods. \author Radu B. Rusu, Michael Dixon \ingroup registration
*/
template <typename PointSource, typename PointTarget, typename Scalar = float>
class Registration : public PCLBase<PointSource> {
public:
using Matrix4 = Eigen::Matrix<Scalar, 4, 4>;
// using PCLBase<PointSource>::initCompute;
using PCLBase<PointSource>::deinitCompute;
using PCLBase<PointSource>::input_;
using PCLBase<PointSource>::indices_;
using Ptr = shared_ptr<Registration<PointSource, PointTarget, Scalar>>;
using ConstPtr = shared_ptr<const Registration<PointSource, PointTarget, Scalar>>;
using CorrespondenceRejectorPtr = pcl::registration::CorrespondenceRejector::Ptr;
using KdTree = pcl::search::KdTree<PointTarget>;
using KdTreePtr = typename KdTree::Ptr;
using KdTreeReciprocal = pcl::search::KdTree<PointSource>;
using KdTreeReciprocalPtr = typename KdTreeReciprocal::Ptr;
using PointCloudSource = pcl::PointCloud<PointSource>;
using PointCloudSourcePtr = typename PointCloudSource::Ptr;
using PointCloudSourceConstPtr = typename PointCloudSource::ConstPtr;
using PointCloudTarget = pcl::PointCloud<PointTarget>;
using PointCloudTargetPtr = typename PointCloudTarget::Ptr;
using PointCloudTargetConstPtr = typename PointCloudTarget::ConstPtr;
using PointRepresentationConstPtr = typename KdTree::PointRepresentationConstPtr;
using TransformationEstimation = typename pcl::registration::
TransformationEstimation<PointSource, PointTarget, Scalar>;
using TransformationEstimationPtr = typename TransformationEstimation::Ptr;
using TransformationEstimationConstPtr = typename TransformationEstimation::ConstPtr;
using CorrespondenceEstimation =
pcl::registration::CorrespondenceEstimationBase<PointSource, PointTarget, Scalar>;
using CorrespondenceEstimationPtr = typename CorrespondenceEstimation::Ptr;
using CorrespondenceEstimationConstPtr = typename CorrespondenceEstimation::ConstPtr;
/** \brief The callback signature to the function updating intermediate source point
* cloud position during it's registration to the target point cloud. \param[in]
* cloud_src - the point cloud which will be updated to match target \param[in]
* indices_src - a selector of points in cloud_src \param[in] cloud_tgt - the point
* cloud we want to register against \param[in] indices_tgt - a selector of points in
* cloud_tgt
*/
using UpdateVisualizerCallbackSignature = void(const pcl::PointCloud<PointSource>&,
const pcl::Indices&,
const pcl::PointCloud<PointTarget>&,
const pcl::Indices&);
/** \brief Empty constructor. */
Registration()
: tree_(new KdTree)
, tree_reciprocal_(new KdTreeReciprocal)
, target_()
, final_transformation_(Matrix4::Identity())
, transformation_(Matrix4::Identity())
, previous_transformation_(Matrix4::Identity())
, euclidean_fitness_epsilon_(-std::numeric_limits<double>::max())
, corr_dist_threshold_(std::sqrt(std::numeric_limits<double>::max()))
, correspondences_(new Correspondences)
, transformation_estimation_()
, correspondence_estimation_()
, point_representation_()
{}
/** \brief destructor. */
~Registration() override = default;
/** \brief Provide a pointer to the transformation estimation object.
* (e.g., SVD, point to plane etc.)
*
* \param[in] te is the pointer to the corresponding transformation estimation object
*
* Code example:
*
* \code
* TransformationEstimationPointToPlaneLLS<PointXYZ, PointXYZ>::Ptr trans_lls
* (new TransformationEstimationPointToPlaneLLS<PointXYZ, PointXYZ>);
* icp.setTransformationEstimation (trans_lls);
* // or...
* TransformationEstimationSVD<PointXYZ, PointXYZ>::Ptr trans_svd
* (new TransformationEstimationSVD<PointXYZ, PointXYZ>);
* icp.setTransformationEstimation (trans_svd);
* \endcode
*/
void
setTransformationEstimation(const TransformationEstimationPtr& te)
{
transformation_estimation_ = te;
}
/** \brief Provide a pointer to the correspondence estimation object.
* (e.g., regular, reciprocal, normal shooting etc.)
*
* \param[in] ce is the pointer to the corresponding correspondence estimation object
*
* Code example:
*
* \code
* CorrespondenceEstimation<PointXYZ, PointXYZ>::Ptr
* ce (new CorrespondenceEstimation<PointXYZ, PointXYZ>);
* ce->setInputSource (source);
* ce->setInputTarget (target);
* icp.setCorrespondenceEstimation (ce);
* // or...
* CorrespondenceEstimationNormalShooting<PointNormal, PointNormal, PointNormal>::Ptr
* cens (new CorrespondenceEstimationNormalShooting<PointNormal, PointNormal>);
* ce->setInputSource (source);
* ce->setInputTarget (target);
* ce->setSourceNormals (source);
* ce->setTargetNormals (target);
* icp.setCorrespondenceEstimation (cens);
* \endcode
*/
void
setCorrespondenceEstimation(const CorrespondenceEstimationPtr& ce)
{
correspondence_estimation_ = ce;
}
/** \brief Provide a pointer to the input source
* (e.g., the point cloud that we want to align to the target)
*
* \param[in] cloud the input point cloud source
*/
virtual void
setInputSource(const PointCloudSourceConstPtr& cloud);
/** \brief Get a pointer to the input point cloud dataset target. */
inline PointCloudSourceConstPtr const
getInputSource()
{
return (input_);
}
/** \brief Provide a pointer to the input target (e.g., the point cloud that we want
* to align the input source to) \param[in] cloud the input point cloud target
*/
virtual inline void
setInputTarget(const PointCloudTargetConstPtr& cloud);
/** \brief Get a pointer to the input point cloud dataset target. */
inline PointCloudTargetConstPtr const
getInputTarget()
{
return (target_);
}
/** \brief Provide a pointer to the search object used to find correspondences in
* the target cloud.
* \param[in] tree a pointer to the spatial search object.
* \param[in] force_no_recompute If set to true, this tree will NEVER be
* recomputed, regardless of calls to setInputTarget. Only use if you are
* confident that the tree will be set correctly.
*/
inline void
setSearchMethodTarget(const KdTreePtr& tree, bool force_no_recompute = false)
{
tree_ = tree;
force_no_recompute_ = force_no_recompute;
// Since we just set a new tree, we need to check for updates
target_cloud_updated_ = true;
}
/** \brief Get a pointer to the search method used to find correspondences in the
* target cloud. */
inline KdTreePtr
getSearchMethodTarget() const
{
return (tree_);
}
/** \brief Provide a pointer to the search object used to find correspondences in
* the source cloud (usually used by reciprocal correspondence finding).
* \param[in] tree a pointer to the spatial search object.
* \param[in] force_no_recompute If set to true, this tree will NEVER be
* recomputed, regardless of calls to setInputSource. Only use if you are
* extremely confident that the tree will be set correctly.
*/
inline void
setSearchMethodSource(const KdTreeReciprocalPtr& tree,
bool force_no_recompute = false)
{
tree_reciprocal_ = tree;
force_no_recompute_reciprocal_ = force_no_recompute;
// Since we just set a new tree, we need to check for updates
source_cloud_updated_ = true;
}
/** \brief Get a pointer to the search method used to find correspondences in the
* source cloud. */
inline KdTreeReciprocalPtr
getSearchMethodSource() const
{
return (tree_reciprocal_);
}
/** \brief Get the final transformation matrix estimated by the registration method.
*/
inline Matrix4
getFinalTransformation()
{
return (final_transformation_);
}
/** \brief Get the last incremental transformation matrix estimated by the
* registration method. */
inline Matrix4
getLastIncrementalTransformation()
{
return (transformation_);
}
/** \brief Set the maximum number of iterations the internal optimization should run
* for. \param[in] nr_iterations the maximum number of iterations the internal
* optimization should run for
*/
inline void
setMaximumIterations(int nr_iterations)
{
max_iterations_ = nr_iterations;
}
/** \brief Get the maximum number of iterations the internal optimization should run
* for, as set by the user. */
inline int
getMaximumIterations()
{
return (max_iterations_);
}
/** \brief Set the number of iterations RANSAC should run for.
* \param[in] ransac_iterations is the number of iterations RANSAC should run for
*/
inline void
setRANSACIterations(int ransac_iterations)
{
ransac_iterations_ = ransac_iterations;
}
/** \brief Get the number of iterations RANSAC should run for, as set by the user. */
inline double
getRANSACIterations()
{
return (ransac_iterations_);
}
/** \brief Set the inlier distance threshold for the internal RANSAC outlier rejection
* loop.
*
* The method considers a point to be an inlier, if the distance between the target
* data index and the transformed source index is smaller than the given inlier
* distance threshold. The value is set by default to 0.05m. \param[in]
* inlier_threshold the inlier distance threshold for the internal RANSAC outlier
* rejection loop
*/
inline void
setRANSACOutlierRejectionThreshold(double inlier_threshold)
{
inlier_threshold_ = inlier_threshold;
}
/** \brief Get the inlier distance threshold for the internal outlier rejection loop
* as set by the user. */
inline double
getRANSACOutlierRejectionThreshold()
{
return (inlier_threshold_);
}
/** \brief Set the maximum distance threshold between two correspondent points in
* source <-> target. If the distance is larger than this threshold, the points will
* be ignored in the alignment process. \param[in] distance_threshold the maximum
* distance threshold between a point and its nearest neighbor correspondent in order
* to be considered in the alignment process
*/
inline void
setMaxCorrespondenceDistance(double distance_threshold)
{
corr_dist_threshold_ = distance_threshold;
}
/** \brief Get the maximum distance threshold between two correspondent points in
* source <-> target. If the distance is larger than this threshold, the points will
* be ignored in the alignment process.
*/
inline double
getMaxCorrespondenceDistance()
{
return (corr_dist_threshold_);
}
/** \brief Set the transformation epsilon (maximum allowable translation squared
* difference between two consecutive transformations) in order for an optimization to
* be considered as having converged to the final solution. \param[in] epsilon the
* transformation epsilon in order for an optimization to be considered as having
* converged to the final solution.
*/
inline void
setTransformationEpsilon(double epsilon)
{
transformation_epsilon_ = epsilon;
}
/** \brief Get the transformation epsilon (maximum allowable translation squared
* difference between two consecutive transformations) as set by the user.
*/
inline double
getTransformationEpsilon()
{
return (transformation_epsilon_);
}
/** \brief Set the transformation rotation epsilon (maximum allowable rotation
* difference between two consecutive transformations) in order for an optimization to
* be considered as having converged to the final solution. \param[in] epsilon the
* transformation rotation epsilon in order for an optimization to be considered as
* having converged to the final solution (epsilon is the cos(angle) in a axis-angle
* representation).
*/
inline void
setTransformationRotationEpsilon(double epsilon)
{
transformation_rotation_epsilon_ = epsilon;
}
/** \brief Get the transformation rotation epsilon (maximum allowable difference
* between two consecutive transformations) as set by the user (epsilon is the
* cos(angle) in a axis-angle representation).
*/
inline double
getTransformationRotationEpsilon()
{
return (transformation_rotation_epsilon_);
}
/** \brief Set the maximum allowed Euclidean error between two consecutive steps in
* the ICP loop, before the algorithm is considered to have converged. The error is
* estimated as the sum of the differences between correspondences in an Euclidean
* sense, divided by the number of correspondences. \param[in] epsilon the maximum
* allowed distance error before the algorithm will be considered to have converged
*/
inline void
setEuclideanFitnessEpsilon(double epsilon)
{
euclidean_fitness_epsilon_ = epsilon;
}
/** \brief Get the maximum allowed distance error before the algorithm will be
* considered to have converged, as set by the user. See \ref
* setEuclideanFitnessEpsilon
*/
inline double
getEuclideanFitnessEpsilon()
{
return (euclidean_fitness_epsilon_);
}
/** \brief Provide a boost shared pointer to the PointRepresentation to be used when
* comparing points \param[in] point_representation the PointRepresentation to be used
* by the k-D tree
*/
inline void
setPointRepresentation(const PointRepresentationConstPtr& point_representation)
{
point_representation_ = point_representation;
}
/** \brief Register the user callback function which will be called from registration
* thread in order to update point cloud obtained after each iteration \param[in]
* visualizerCallback reference of the user callback function
*/
inline bool
registerVisualizationCallback(
std::function<UpdateVisualizerCallbackSignature>& visualizerCallback)
{
if (visualizerCallback) {
update_visualizer_ = visualizerCallback;
pcl::Indices indices;
update_visualizer_(*input_, indices, *target_, indices);
return (true);
}
return (false);
}
/** \brief Obtain the Euclidean fitness score (e.g., mean of squared distances from
* the source to the target) \param[in] max_range maximum allowable distance between a
* point and its correspondence in the target (default: double::max)
*/
inline double
getFitnessScore(double max_range = std::numeric_limits<double>::max());
/** \brief Obtain the Euclidean fitness score (e.g., mean of squared distances from
* the source to the target) from two sets of correspondence distances (distances
* between source and target points) \param[in] distances_a the first set of distances
* between correspondences \param[in] distances_b the second set of distances between
* correspondences
*/
inline double
getFitnessScore(const std::vector<float>& distances_a,
const std::vector<float>& distances_b);
/** \brief Return the state of convergence after the last align run */
inline bool
hasConverged() const
{
return (converged_);
}
/** \brief Call the registration algorithm which estimates the transformation and
* returns the transformed source (input) as \a output. \param[out] output the
* resultant input transformed point cloud dataset
*/
inline void
align(PointCloudSource& output);
/** \brief Call the registration algorithm which estimates the transformation and
* returns the transformed source (input) as \a output. \param[out] output the
* resultant input transformed point cloud dataset \param[in] guess the initial gross
* estimation of the transformation
*/
inline void
align(PointCloudSource& output, const Matrix4& guess);
/** \brief Abstract class get name method. */
inline const std::string&
getClassName() const
{
return (reg_name_);
}
/** \brief Internal computation initialization. */
bool
initCompute();
/** \brief Internal computation when reciprocal lookup is needed */
bool
initComputeReciprocal();
/** \brief Add a new correspondence rejector to the list
* \param[in] rejector the new correspondence rejector to concatenate
*
* Code example:
*
* \code
* CorrespondenceRejectorDistance rej;
* rej.setInputCloud<PointXYZ> (keypoints_src);
* rej.setInputTarget<PointXYZ> (keypoints_tgt);
* rej.setMaximumDistance (1);
* rej.setInputCorrespondences (all_correspondences);
*
* // or...
*
* \endcode
*/
inline void
addCorrespondenceRejector(const CorrespondenceRejectorPtr& rejector)
{
correspondence_rejectors_.push_back(rejector);
}
/** \brief Get the list of correspondence rejectors. */
inline std::vector<CorrespondenceRejectorPtr>
getCorrespondenceRejectors()
{
return (correspondence_rejectors_);
}
/** \brief Remove the i-th correspondence rejector in the list
* \param[in] i the position of the correspondence rejector in the list to remove
*/
inline bool
removeCorrespondenceRejector(unsigned int i)
{
if (i >= correspondence_rejectors_.size())
return (false);
correspondence_rejectors_.erase(correspondence_rejectors_.begin() + i);
return (true);
}
/** \brief Clear the list of correspondence rejectors. */
inline void
clearCorrespondenceRejectors()
{
correspondence_rejectors_.clear();
}
protected:
/** \brief The registration method name. */
std::string reg_name_;
/** \brief A pointer to the spatial search object. */
KdTreePtr tree_;
/** \brief A pointer to the spatial search object of the source. */
KdTreeReciprocalPtr tree_reciprocal_;
/** \brief The number of iterations the internal optimization ran for (used
* internally). */
int nr_iterations_{0};
/** \brief The maximum number of iterations the internal optimization should run for.
* The default value is 10.
*/
int max_iterations_{10};
/** \brief The number of iterations RANSAC should run for. */
int ransac_iterations_{0};
/** \brief The input point cloud dataset target. */
PointCloudTargetConstPtr target_;
/** \brief The final transformation matrix estimated by the registration method after
* N iterations. */
Matrix4 final_transformation_;
/** \brief The transformation matrix estimated by the registration method. */
Matrix4 transformation_;
/** \brief The previous transformation matrix estimated by the registration method
* (used internally). */
Matrix4 previous_transformation_;
/** \brief The maximum difference between two consecutive transformations in order to
* consider convergence (user defined).
*/
double transformation_epsilon_{0.0};
/** \brief The maximum rotation difference between two consecutive transformations in
* order to consider convergence (user defined).
*/
double transformation_rotation_epsilon_{0.0};
/** \brief The maximum allowed Euclidean error between two consecutive steps in the
* ICP loop, before the algorithm is considered to have converged. The error is
* estimated as the sum of the differences between correspondences in an Euclidean
* sense, divided by the number of correspondences.
*/
double euclidean_fitness_epsilon_;
/** \brief The maximum distance threshold between two correspondent points in source
* <-> target. If the distance is larger than this threshold, the points will be
* ignored in the alignment process.
*/
double corr_dist_threshold_;
/** \brief The inlier distance threshold for the internal RANSAC outlier rejection
* loop. The method considers a point to be an inlier, if the distance between the
* target data index and the transformed source index is smaller than the given inlier
* distance threshold. The default value is 0.05.
*/
double inlier_threshold_{0.05};
/** \brief Holds internal convergence state, given user parameters. */
bool converged_{false};
/** \brief The minimum number of correspondences that the algorithm needs before
* attempting to estimate the transformation. The default value is 3.
*/
unsigned int min_number_correspondences_{3};
/** \brief The set of correspondences determined at this ICP step. */
CorrespondencesPtr correspondences_;
/** \brief A TransformationEstimation object, used to calculate the 4x4 rigid
* transformation. */
TransformationEstimationPtr transformation_estimation_;
/** \brief A CorrespondenceEstimation object, used to estimate correspondences between
* the source and the target cloud. */
CorrespondenceEstimationPtr correspondence_estimation_;
/** \brief The list of correspondence rejectors to use. */
std::vector<CorrespondenceRejectorPtr> correspondence_rejectors_;
/** \brief Variable that stores whether we have a new target cloud, meaning we need to
* pre-process it again. This way, we avoid rebuilding the kd-tree for the target
* cloud every time the determineCorrespondences () method is called. */
bool target_cloud_updated_{true};
/** \brief Variable that stores whether we have a new source cloud, meaning we need to
* pre-process it again. This way, we avoid rebuilding the reciprocal kd-tree for the
* source cloud every time the determineCorrespondences () method is called. */
bool source_cloud_updated_{true};
/** \brief A flag which, if set, means the tree operating on the target cloud
* will never be recomputed*/
bool force_no_recompute_{false};
/** \brief A flag which, if set, means the tree operating on the source cloud
* will never be recomputed*/
bool force_no_recompute_reciprocal_{false};
/** \brief Callback function to update intermediate source point cloud position during
* it's registration to the target point cloud.
*/
std::function<UpdateVisualizerCallbackSignature> update_visualizer_;
/** \brief Search for the closest nearest neighbor of a given point.
* \param cloud the point cloud dataset to use for nearest neighbor search
* \param index the index of the query point
* \param indices the resultant vector of indices representing the k-nearest neighbors
* \param distances the resultant distances from the query point to the k-nearest
* neighbors
*/
inline bool
searchForNeighbors(const PointCloudSource& cloud,
int index,
pcl::Indices& indices,
std::vector<float>& distances)
{
int k = tree_->nearestKSearch(cloud, index, 1, indices, distances);
if (k == 0)
return (false);
return (true);
}
/** \brief Abstract transformation computation method with initial guess */
virtual void
computeTransformation(PointCloudSource& output, const Matrix4& guess) = 0;
private:
/** \brief The point representation used (internal). */
PointRepresentationConstPtr point_representation_;
/**
* \brief Remove from public API in favor of \ref setInputSource
*
* Still gives the correct result (with a warning)
*/
void
setInputCloud(const PointCloudSourceConstPtr& cloud) override
{
PCL_WARN("[pcl::registration::Registration] setInputCloud is deprecated."
"Please use setInputSource instead.\n");
setInputSource(cloud);
}
public:
PCL_MAKE_ALIGNED_OPERATOR_NEW
};
} // namespace pcl
#include <pcl/registration/impl/registration.hpp>
pcl::PCLBase
PCL base class.
Definition pcl_base.h:70
pcl::PCLBase< PointSource >::input_
PointCloudConstPtr input_
The input point cloud dataset.
Definition pcl_base.h:147
pcl::PCLBase< PointSource >::indices_
IndicesPtr indices_
A pointer to the vector of point indices to use.
Definition pcl_base.h:150
pcl::PCLBase< PointSource >::deinitCompute
bool deinitCompute()
This method should get called after finishing the actual computation.
Definition pcl_base.hpp:175
pcl::PointCloud< PointSource >
pcl::PointCloud< PointSource >::Ptr
shared_ptr< PointCloud< PointSource > > Ptr
Definition point_cloud.h:413
pcl::PointCloud< PointSource >::ConstPtr
shared_ptr< const PointCloud< PointSource > > ConstPtr
Definition point_cloud.h:414
pcl::Registration
Registration represents the base registration class for general purpose, ICP-like methods.
Definition registration.h:57
pcl::Registration::target_cloud_updated_
bool target_cloud_updated_
Variable that stores whether we have a new target cloud, meaning we need to pre-process it again.
Definition registration.h:637
pcl::Registration::final_transformation_
Matrix4 final_transformation_
The final transformation matrix estimated by the registration method after N iterations.
Definition registration.h:573
pcl::Registration::KdTreeReciprocalPtr
typename KdTreeReciprocal::Ptr KdTreeReciprocalPtr
Definition registration.h:74
pcl::Registration::initCompute
bool initCompute()
Internal computation initialization.
Definition registration.hpp:75
pcl::Registration::update_visualizer_
std::function< UpdateVisualizerCallbackSignature > update_visualizer_
Callback function to update intermediate source point cloud position during it's registration to the ...
Definition registration.h:653
pcl::Registration::setInputSource
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)
Definition registration.hpp:47
pcl::Registration::corr_dist_threshold_
double corr_dist_threshold_
The maximum distance threshold between two correspondent points in source <-> target.
Definition registration.h:603
pcl::Registration::clearCorrespondenceRejectors
void clearCorrespondenceRejectors()
Clear the list of correspondence rejectors.
Definition registration.h:541
pcl::Registration::getTransformationEpsilon
double getTransformationEpsilon()
Get the transformation epsilon (maximum allowable translation squared difference between two consecut...
Definition registration.h:367
pcl::Registration::UpdateVisualizerCallbackSignature
void(const pcl::PointCloud< PointSource > &, const pcl::Indices &, const pcl::PointCloud< PointTarget > &, const pcl::Indices &) UpdateVisualizerCallbackSignature
The callback signature to the function updating intermediate source point cloud position during it's ...
Definition registration.h:106
pcl::Registration::reg_name_
std::string reg_name_
The registration method name.
Definition registration.h:548
pcl::Registration::getFinalTransformation
Matrix4 getFinalTransformation()
Get the final transformation matrix estimated by the registration method.
Definition registration.h:259
pcl::Registration::setRANSACIterations
void setRANSACIterations(int ransac_iterations)
Set the number of iterations RANSAC should run for.
Definition registration.h:294
pcl::Registration::ConstPtr
shared_ptr< const Registration< PointSource, PointTarget, Scalar > > ConstPtr
Definition registration.h:67
pcl::Registration::transformation_
Matrix4 transformation_
The transformation matrix estimated by the registration method.
Definition registration.h:576
pcl::Registration::PointCloudSource
pcl::PointCloud< PointSource > PointCloudSource
Definition registration.h:76
pcl::Registration::tree_reciprocal_
KdTreeReciprocalPtr tree_reciprocal_
A pointer to the spatial search object of the source.
Definition registration.h:554
pcl::Registration::removeCorrespondenceRejector
bool removeCorrespondenceRejector(unsigned int i)
Remove the i-th correspondence rejector in the list.
Definition registration.h:531
pcl::Registration::setCorrespondenceEstimation
void setCorrespondenceEstimation(const CorrespondenceEstimationPtr &ce)
Provide a pointer to the correspondence estimation object.
Definition registration.h:174
pcl::Registration::CorrespondenceEstimationConstPtr
typename CorrespondenceEstimation::ConstPtr CorrespondenceEstimationConstPtr
Definition registration.h:94
pcl::Registration::setMaximumIterations
void setMaximumIterations(int nr_iterations)
Set the maximum number of iterations the internal optimization should run for.
Definition registration.h:277
pcl::Registration::setSearchMethodSource
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...
Definition registration.h:239
pcl::Registration::setSearchMethodTarget
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.
Definition registration.h:215
pcl::Registration::PointCloudSourceConstPtr
typename PointCloudSource::ConstPtr PointCloudSourceConstPtr
Definition registration.h:78
pcl::Registration::KdTreePtr
typename KdTree::Ptr KdTreePtr
Definition registration.h:71
pcl::Registration::setInputTarget
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...
Definition registration.hpp:61
pcl::Registration::registerVisualizationCallback
bool registerVisualizationCallback(std::function< UpdateVisualizerCallbackSignature > &visualizerCallback)
Register the user callback function which will be called from registration thread in order to update ...
Definition registration.h:432
pcl::Registration::TransformationEstimationPtr
typename TransformationEstimation::Ptr TransformationEstimationPtr
Definition registration.h:88
pcl::Registration::PointCloudSourcePtr
typename PointCloudSource::Ptr PointCloudSourcePtr
Definition registration.h:77
pcl::Registration::setPointRepresentation
void setPointRepresentation(const PointRepresentationConstPtr &point_representation)
Provide a boost shared pointer to the PointRepresentation to be used when comparing points.
Definition registration.h:422
pcl::Registration::correspondence_estimation_
CorrespondenceEstimationPtr correspondence_estimation_
A CorrespondenceEstimation object, used to estimate correspondences between the source and the target...
Definition registration.h:629
pcl::Registration::PointCloudTargetConstPtr
typename PointCloudTarget::ConstPtr PointCloudTargetConstPtr
Definition registration.h:82
pcl::Registration::getTransformationRotationEpsilon
double getTransformationRotationEpsilon()
Get the transformation rotation epsilon (maximum allowable difference between two consecutive transfo...
Definition registration.h:390
pcl::Registration::force_no_recompute_
bool force_no_recompute_
A flag which, if set, means the tree operating on the target cloud will never be recomputed.
Definition registration.h:644
pcl::Registration::setRANSACOutlierRejectionThreshold
void setRANSACOutlierRejectionThreshold(double inlier_threshold)
Set the inlier distance threshold for the internal RANSAC outlier rejection loop.
Definition registration.h:316
pcl::Registration::setMaxCorrespondenceDistance
void setMaxCorrespondenceDistance(double distance_threshold)
Set the maximum distance threshold between two correspondent points in source <-> target.
Definition registration.h:336
pcl::Registration::addCorrespondenceRejector
void addCorrespondenceRejector(const CorrespondenceRejectorPtr &rejector)
Add a new correspondence rejector to the list.
Definition registration.h:515
pcl::Registration::nr_iterations_
int nr_iterations_
The number of iterations the internal optimization ran for (used internally).
Definition registration.h:558
pcl::Registration::Ptr
shared_ptr< Registration< PointSource, PointTarget, Scalar > > Ptr
Definition registration.h:66
pcl::Registration::getRANSACOutlierRejectionThreshold
double getRANSACOutlierRejectionThreshold()
Get the inlier distance threshold for the internal outlier rejection loop as set by the user.
Definition registration.h:324
pcl::Registration::getEuclideanFitnessEpsilon
double getEuclideanFitnessEpsilon()
Get the maximum allowed distance error before the algorithm will be considered to have converged,...
Definition registration.h:412
pcl::Registration::getMaxCorrespondenceDistance
double getMaxCorrespondenceDistance()
Get the maximum distance threshold between two correspondent points in source <-> target.
Definition registration.h:346
pcl::Registration::getSearchMethodTarget
KdTreePtr getSearchMethodTarget() const
Get a pointer to the search method used to find correspondences in the target cloud.
Definition registration.h:226
pcl::Registration::tree_
KdTreePtr tree_
A pointer to the spatial search object.
Definition registration.h:551
pcl::Registration::Registration
Registration()
Empty constructor.
Definition registration.h:109
pcl::Registration::getLastIncrementalTransformation
Matrix4 getLastIncrementalTransformation()
Get the last incremental transformation matrix estimated by the registration method.
Definition registration.h:267
pcl::Registration::PointCloudTargetPtr
typename PointCloudTarget::Ptr PointCloudTargetPtr
Definition registration.h:81
pcl::Registration::previous_transformation_
Matrix4 previous_transformation_
The previous transformation matrix estimated by the registration method (used internally).
Definition registration.h:580
pcl::Registration::converged_
bool converged_
Holds internal convergence state, given user parameters.
Definition registration.h:613
pcl::Registration::ransac_iterations_
int ransac_iterations_
The number of iterations RANSAC should run for.
Definition registration.h:566
pcl::Registration::Matrix4
Eigen::Matrix< Scalar, 4, 4 > Matrix4
Definition registration.h:59
pcl::Registration::align
void align(PointCloudSource &output)
Call the registration algorithm which estimates the transformation and returns the transformed source...
Definition registration.hpp:166
pcl::Registration::getInputTarget
PointCloudTargetConstPtr const getInputTarget()
Get a pointer to the input point cloud dataset target.
Definition registration.h:202
pcl::Registration::correspondences_
CorrespondencesPtr correspondences_
The set of correspondences determined at this ICP step.
Definition registration.h:621
pcl::Registration::transformation_estimation_
TransformationEstimationPtr transformation_estimation_
A TransformationEstimation object, used to calculate the 4x4 rigid transformation.
Definition registration.h:625
pcl::Registration::searchForNeighbors
bool searchForNeighbors(const PointCloudSource &cloud, int index, pcl::Indices &indices, std::vector< float > &distances)
Search for the closest nearest neighbor of a given point.
Definition registration.h:663
pcl::Registration::max_iterations_
int max_iterations_
The maximum number of iterations the internal optimization should run for.
Definition registration.h:563
pcl::Registration::transformation_rotation_epsilon_
double transformation_rotation_epsilon_
The maximum rotation difference between two consecutive transformations in order to consider converge...
Definition registration.h:590
pcl::Registration::min_number_correspondences_
unsigned int min_number_correspondences_
The minimum number of correspondences that the algorithm needs before attempting to estimate the tran...
Definition registration.h:618
pcl::Registration::getFitnessScore
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)
Definition registration.hpp:134
pcl::Registration::euclidean_fitness_epsilon_
double euclidean_fitness_epsilon_
The maximum allowed Euclidean error between two consecutive steps in the ICP loop,...
Definition registration.h:597
pcl::Registration::inlier_threshold_
double inlier_threshold_
The inlier distance threshold for the internal RANSAC outlier rejection loop.
Definition registration.h:610
pcl::Registration::CorrespondenceRejectorPtr
pcl::registration::CorrespondenceRejector::Ptr CorrespondenceRejectorPtr
Definition registration.h:69
pcl::Registration::getInputSource
PointCloudSourceConstPtr const getInputSource()
Get a pointer to the input point cloud dataset target.
Definition registration.h:189
pcl::Registration::TransformationEstimationConstPtr
typename TransformationEstimation::ConstPtr TransformationEstimationConstPtr
Definition registration.h:89
pcl::Registration::TransformationEstimation
typename pcl::registration::TransformationEstimation< PointSource, PointTarget, Scalar > TransformationEstimation
Definition registration.h:87
pcl::Registration::hasConverged
bool hasConverged() const
Return the state of convergence after the last align run.
Definition registration.h:463
pcl::Registration::PointRepresentationConstPtr
typename KdTree::PointRepresentationConstPtr PointRepresentationConstPtr
Definition registration.h:84
pcl::Registration::setTransformationEstimation
void setTransformationEstimation(const TransformationEstimationPtr &te)
Provide a pointer to the transformation estimation object.
Definition registration.h:145
pcl::Registration::force_no_recompute_reciprocal_
bool force_no_recompute_reciprocal_
A flag which, if set, means the tree operating on the source cloud will never be recomputed.
Definition registration.h:648
pcl::Registration::transformation_epsilon_
double transformation_epsilon_
The maximum difference between two consecutive transformations in order to consider convergence (user...
Definition registration.h:585
pcl::Registration::getCorrespondenceRejectors
std::vector< CorrespondenceRejectorPtr > getCorrespondenceRejectors()
Get the list of correspondence rejectors.
Definition registration.h:522
pcl::Registration::correspondence_rejectors_
std::vector< CorrespondenceRejectorPtr > correspondence_rejectors_
The list of correspondence rejectors to use.
Definition registration.h:632
pcl::Registration::getSearchMethodSource
KdTreeReciprocalPtr getSearchMethodSource() const
Get a pointer to the search method used to find correspondences in the source cloud.
Definition registration.h:251
pcl::Registration::~Registration
~Registration() override=default
destructor.
pcl::Registration::getMaximumIterations
int getMaximumIterations()
Get the maximum number of iterations the internal optimization should run for, as set by the user.
Definition registration.h:285
pcl::Registration::setTransformationRotationEpsilon
void setTransformationRotationEpsilon(double epsilon)
Set the transformation rotation epsilon (maximum allowable rotation difference between two consecutiv...
Definition registration.h:380
pcl::Registration::initComputeReciprocal
bool initComputeReciprocal()
Internal computation when reciprocal lookup is needed.
Definition registration.hpp:105
pcl::Registration::computeTransformation
virtual void computeTransformation(PointCloudSource &output, const Matrix4 &guess)=0
Abstract transformation computation method with initial guess.
pcl::Registration::CorrespondenceEstimationPtr
typename CorrespondenceEstimation::Ptr CorrespondenceEstimationPtr
Definition registration.h:93
pcl::Registration::setEuclideanFitnessEpsilon
void setEuclideanFitnessEpsilon(double epsilon)
Set the maximum allowed Euclidean error between two consecutive steps in the ICP loop,...
Definition registration.h:402
pcl::Registration::setTransformationEpsilon
void setTransformationEpsilon(double epsilon)
Set the transformation epsilon (maximum allowable translation squared difference between two consecut...
Definition registration.h:358
pcl::Registration::source_cloud_updated_
bool source_cloud_updated_
Variable that stores whether we have a new source cloud, meaning we need to pre-process it again.
Definition registration.h:641
pcl::Registration::target_
PointCloudTargetConstPtr target_
The input point cloud dataset target.
Definition registration.h:569
pcl::Registration::getClassName
const std::string & getClassName() const
Abstract class get name method.
Definition registration.h:485
pcl::Registration::getRANSACIterations
double getRANSACIterations()
Get the number of iterations RANSAC should run for, as set by the user.
Definition registration.h:301
pcl::registration::CorrespondenceEstimationBase
Abstract CorrespondenceEstimationBase class.
Definition correspondence_estimation.h:60
pcl::registration::CorrespondenceEstimationBase::ConstPtr
shared_ptr< const CorrespondenceEstimationBase< PointSource, PointTarget, Scalar > > ConstPtr
Definition correspondence_estimation.h:65
pcl::registration::CorrespondenceEstimationBase::Ptr
shared_ptr< CorrespondenceEstimationBase< PointSource, PointTarget, Scalar > > Ptr
Definition correspondence_estimation.h:63
pcl::registration::CorrespondenceRejector::Ptr
shared_ptr< CorrespondenceRejector > Ptr
Definition correspondence_rejection.h:56
pcl::search::KdTree
search::KdTree is a wrapper class which inherits the pcl::KdTree class for performing search function...
Definition kdtree.h:62
pcl::search::KdTree::Ptr
shared_ptr< KdTree< PointT, Tree > > Ptr
Definition kdtree.h:75
pcl::search::KdTree::PointRepresentationConstPtr
typename PointRepresentation< PointT >::ConstPtr PointRepresentationConstPtr
Definition kdtree.h:80
PCL_MAKE_ALIGNED_OPERATOR_NEW
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition memory.h:63
memory.h
Defines functions, macros and traits for allocating and using memory.
pcl
Definition convolution.h:46
pcl::CorrespondencesPtr
shared_ptr< Correspondences > CorrespondencesPtr
Definition correspondence.h:90
pcl::Correspondences
std::vector< pcl::Correspondence, Eigen::aligned_allocator< pcl::Correspondence > > Correspondences
Definition correspondence.h:89
pcl::Indices
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition types.h:133
pcl_macros.h
Defines all the PCL and non-PCL macros used.