GeneralizedIterativeClosestPoint is an ICP variant that implements the generalized iterative closest point algorithm as described by Alex Segal et al. in http://www.stanford.edu/~avsegal/resources/papers/Generalized_ICP.pdf The approach is based on using anistropic cost functions to optimize the alignment after closest point assignments have been made. The original code uses GSL and ANN while in ours we use an eigen mapped BFGS and FLANN. More...
#include <gicp.h>
Classes | |
struct | OptimizationFunctorWithIndices |
optimization functor structure More... | |
Public Types | |
typedef boost::shared_ptr < const GeneralizedIterativeClosestPoint < PointSource, PointTarget > > | ConstPtr |
typedef Registration < PointSource, PointTarget > ::KdTree | InputKdTree |
typedef Registration < PointSource, PointTarget > ::KdTreePtr | InputKdTreePtr |
typedef pcl::PointCloud < PointSource > | PointCloudSource |
typedef PointCloudSource::ConstPtr | PointCloudSourceConstPtr |
typedef PointCloudSource::Ptr | PointCloudSourcePtr |
typedef pcl::PointCloud < PointTarget > | PointCloudTarget |
typedef PointCloudTarget::ConstPtr | PointCloudTargetConstPtr |
typedef PointCloudTarget::Ptr | PointCloudTargetPtr |
typedef PointIndices::ConstPtr | PointIndicesConstPtr |
typedef PointIndices::Ptr | PointIndicesPtr |
typedef boost::shared_ptr < GeneralizedIterativeClosestPoint < PointSource, PointTarget > > | Ptr |
typedef Eigen::Matrix< double, 6, 1 > | Vector6d |
Public Member Functions | |
void | computeRDerivative (const Vector6d &x, const Eigen::Matrix3d &R, Vector6d &g) const |
Computes rotation matrix derivative. rotation matrix is obtainded from rotation angles x[3], x[4] and x[5]. | |
void | estimateRigidTransformationBFGS (const PointCloudSource &cloud_src, const std::vector< int > &indices_src, const PointCloudTarget &cloud_tgt, const std::vector< int > &indices_tgt, Eigen::Matrix4f &transformation_matrix) |
Estimate a rigid rotation transformation between a source and a target point cloud using an iterative non-linear Levenberg-Marquardt approach. | |
GeneralizedIterativeClosestPoint () | |
Empty constructor. | |
int | getCorrespondenceRandomness () |
Get the number of neighbors used when computing covariances as set by the user. | |
int | getMaximumOptimizerIterations () |
double | getRotationEpsilon () |
Get the rotation epsilon (maximum allowable difference between two consecutive rotations) as set by the user. | |
const Eigen::Matrix3d & | mahalanobis (size_t index) const |
PCL_DEPRECATED (void setInputCloud(const PointCloudSourceConstPtr &cloud),"[pcl::registration::GeneralizedIterativeClosestPoint::setInputCloud] setInputCloud is deprecated. Please use setInputSource instead.") | |
Provide a pointer to the input dataset. | |
void | setCorrespondenceRandomness (int k) |
Set the number of neighbors used when selecting a point neighbourhood to compute covariances. A higher value will bring more accurate covariance matrix but will make covariances computation slower. | |
void | setInputSource (const PointCloudSourceConstPtr &cloud) |
Provide a pointer to the input dataset. | |
void | setInputTarget (const PointCloudTargetConstPtr &target) |
Provide a pointer to the input target (e.g., the point cloud that we want to align the input source to) | |
void | setMaximumOptimizerIterations (int max) |
void | setRotationEpsilon (double epsilon) |
Set the rotation epsilon (maximum allowable difference between two consecutive rotations) in order for an optimization to be considered as having converged to the final solution. | |
Protected Member Functions | |
void | applyState (Eigen::Matrix4f &t, const Vector6d &x) const |
compute transformation matrix from transformation matrix | |
template<typename PointT > | |
void | computeCovariances (typename pcl::PointCloud< PointT >::ConstPtr cloud, const typename pcl::search::KdTree< PointT >::Ptr tree, std::vector< Eigen::Matrix3d > &cloud_covariances) |
compute points covariances matrices according to the K nearest neighbors. K is set via setCorrespondenceRandomness() methode. | |
void | computeTransformation (PointCloudSource &output, const Eigen::Matrix4f &guess) |
Rigid transformation computation method with initial guess. | |
double | matricesInnerProd (const Eigen::MatrixXd &mat1, const Eigen::MatrixXd &mat2) const |
bool | searchForNeighbors (const PointSource &query, std::vector< int > &index, std::vector< float > &distance) |
Search for the closest nearest neighbor of a given point. | |
Protected Attributes | |
Eigen::Matrix4f | base_transformation_ |
base transformation | |
double | gicp_epsilon_ |
The epsilon constant for gicp paper; this is NOT the convergence tolerence default: 0.001. | |
std::vector< Eigen::Matrix3d > | input_covariances_ |
Input cloud points covariances. | |
int | k_correspondences_ |
The number of neighbors used for covariances computation. default: 20. | |
std::vector< Eigen::Matrix3d > | mahalanobis_ |
Mahalanobis matrices holder. | |
int | max_inner_iterations_ |
maximum number of optimizations | |
boost::function< void(const pcl::PointCloud< PointSource > &cloud_src, const std::vector < int > &src_indices, const pcl::PointCloud< PointTarget > &cloud_tgt, const std::vector < int > &tgt_indices, Eigen::Matrix4f &transformation_matrix)> | rigid_transformation_estimation_ |
double | rotation_epsilon_ |
std::vector< Eigen::Matrix3d > | target_covariances_ |
Target cloud points covariances. | |
const std::vector< int > * | tmp_idx_src_ |
Temporary pointer to the source dataset indices. | |
const std::vector< int > * | tmp_idx_tgt_ |
Temporary pointer to the target dataset indices. | |
const PointCloudSource * | tmp_src_ |
Temporary pointer to the source dataset. | |
const PointCloudTarget * | tmp_tgt_ |
Temporary pointer to the target dataset. |
GeneralizedIterativeClosestPoint is an ICP variant that implements the generalized iterative closest point algorithm as described by Alex Segal et al. in http://www.stanford.edu/~avsegal/resources/papers/Generalized_ICP.pdf The approach is based on using anistropic cost functions to optimize the alignment after closest point assignments have been made. The original code uses GSL and ANN while in ours we use an eigen mapped BFGS and FLANN.
typedef boost::shared_ptr< const GeneralizedIterativeClosestPoint<PointSource, PointTarget> > pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::ConstPtr |
Reimplemented from pcl::IterativeClosestPoint< PointSource, PointTarget >.
typedef Registration<PointSource, PointTarget>::KdTree pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::InputKdTree |
typedef Registration<PointSource, PointTarget>::KdTreePtr pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::InputKdTreePtr |
typedef pcl::PointCloud<PointSource> pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PointCloudSource |
Reimplemented from pcl::IterativeClosestPoint< PointSource, PointTarget >.
typedef PointCloudSource::ConstPtr pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PointCloudSourceConstPtr |
Reimplemented from pcl::IterativeClosestPoint< PointSource, PointTarget >.
typedef PointCloudSource::Ptr pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PointCloudSourcePtr |
Reimplemented from pcl::IterativeClosestPoint< PointSource, PointTarget >.
typedef pcl::PointCloud<PointTarget> pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PointCloudTarget |
Reimplemented from pcl::IterativeClosestPoint< PointSource, PointTarget >.
typedef PointCloudTarget::ConstPtr pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PointCloudTargetConstPtr |
Reimplemented from pcl::IterativeClosestPoint< PointSource, PointTarget >.
typedef PointCloudTarget::Ptr pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PointCloudTargetPtr |
Reimplemented from pcl::IterativeClosestPoint< PointSource, PointTarget >.
typedef PointIndices::ConstPtr pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PointIndicesConstPtr |
Reimplemented from pcl::IterativeClosestPoint< PointSource, PointTarget >.
typedef PointIndices::Ptr pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PointIndicesPtr |
Reimplemented from pcl::IterativeClosestPoint< PointSource, PointTarget >.
typedef boost::shared_ptr< GeneralizedIterativeClosestPoint<PointSource, PointTarget> > pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::Ptr |
Reimplemented from pcl::IterativeClosestPoint< PointSource, PointTarget >.
typedef Eigen::Matrix<double, 6, 1> pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::Vector6d |
pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::GeneralizedIterativeClosestPoint | ( | ) | [inline] |
void pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::applyState | ( | Eigen::Matrix4f & | t, |
const Vector6d & | x | ||
) | const [protected] |
void pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::computeCovariances | ( | typename pcl::PointCloud< PointT >::ConstPtr | cloud, |
const typename pcl::search::KdTree< PointT >::Ptr | tree, | ||
std::vector< Eigen::Matrix3d > & | cloud_covariances | ||
) | [protected] |
compute points covariances matrices according to the K nearest neighbors. K is set via setCorrespondenceRandomness() methode.
cloud | pointer to point cloud |
tree | KD tree performer for nearest neighbors search |
void pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::computeRDerivative | ( | const Vector6d & | x, |
const Eigen::Matrix3d & | R, | ||
Vector6d & | g | ||
) | const |
Computes rotation matrix derivative. rotation matrix is obtainded from rotation angles x[3], x[4] and x[5].
void pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::computeTransformation | ( | PointCloudSource & | output, |
const Eigen::Matrix4f & | guess | ||
) | [inline, protected] |
void pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::estimateRigidTransformationBFGS | ( | const PointCloudSource & | cloud_src, |
const std::vector< int > & | indices_src, | ||
const PointCloudTarget & | cloud_tgt, | ||
const std::vector< int > & | indices_tgt, | ||
Eigen::Matrix4f & | transformation_matrix | ||
) |
Estimate a rigid rotation transformation between a source and a target point cloud using an iterative non-linear Levenberg-Marquardt approach.
[in] | cloud_src | the source point cloud dataset |
[in] | indices_src | the vector of indices describing the points of interest in cloud_src |
[in] | cloud_tgt | the target point cloud dataset |
[in] | indices_tgt | the vector of indices describing the correspondences of the interst points from indices_src |
[out] | transformation_matrix | the resultant transformation matrix |
int pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::getCorrespondenceRandomness | ( | ) | [inline] |
int pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::getMaximumOptimizerIterations | ( | ) | [inline] |
double pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::getRotationEpsilon | ( | ) | [inline] |
const Eigen::Matrix3d& pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::mahalanobis | ( | size_t | index | ) | const [inline] |
double pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::matricesInnerProd | ( | const Eigen::MatrixXd & | mat1, |
const Eigen::MatrixXd & | mat2 | ||
) | const [inline, protected] |
pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PCL_DEPRECATED | ( | void | setInputCloudconst PointCloudSourceConstPtr &cloud, |
" setInputCloud is deprecated. Please use setInputSource instead." | [pcl::registration::GeneralizedIterativeClosestPoint::setInputCloud] | ||
) |
Provide a pointer to the input dataset.
cloud | the const boost shared pointer to a PointCloud message |
bool pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::searchForNeighbors | ( | const PointSource & | query, |
std::vector< int > & | index, | ||
std::vector< float > & | distance | ||
) | [inline, protected] |
Search for the closest nearest neighbor of a given point.
query | the point to search a nearest neighbour for |
index | vector of size 1 to store the index of the nearest neighbour found |
distance | vector of size 1 to store the distance to nearest neighbour found |
void pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::setCorrespondenceRandomness | ( | int | k | ) | [inline] |
Set the number of neighbors used when selecting a point neighbourhood to compute covariances. A higher value will bring more accurate covariance matrix but will make covariances computation slower.
k | the number of neighbors to use when computing covariances |
void pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::setInputSource | ( | const PointCloudSourceConstPtr & | cloud | ) | [inline, virtual] |
Provide a pointer to the input dataset.
cloud | the const boost shared pointer to a PointCloud message |
Reimplemented from pcl::Registration< PointSource, PointTarget, float >.
void pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::setInputTarget | ( | const PointCloudTargetConstPtr & | target | ) | [inline] |
void pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::setMaximumOptimizerIterations | ( | int | max | ) | [inline] |
void pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::setRotationEpsilon | ( | double | epsilon | ) | [inline] |
Eigen::Matrix4f pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::base_transformation_ [protected] |
double pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::gicp_epsilon_ [protected] |
std::vector<Eigen::Matrix3d> pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::input_covariances_ [protected] |
int pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::k_correspondences_ [protected] |
std::vector<Eigen::Matrix3d> pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::mahalanobis_ [protected] |
int pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::max_inner_iterations_ [protected] |
boost::function<void(const pcl::PointCloud<PointSource> &cloud_src, const std::vector<int> &src_indices, const pcl::PointCloud<PointTarget> &cloud_tgt, const std::vector<int> &tgt_indices, Eigen::Matrix4f &transformation_matrix)> pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::rigid_transformation_estimation_ [protected] |
double pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::rotation_epsilon_ [protected] |
std::vector<Eigen::Matrix3d> pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::target_covariances_ [protected] |
const std::vector<int>* pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::tmp_idx_src_ [protected] |
const std::vector<int>* pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::tmp_idx_tgt_ [protected] |
const PointCloudSource* pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::tmp_src_ [protected] |
const PointCloudTarget* pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::tmp_tgt_ [protected] |