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 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 |
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 | setInputCloud (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 Attributes | |
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_ |
Private Types | |
typedef pcl::KdTree< PointSource > | InputKdTree |
typedef pcl::KdTree < PointSource >::Ptr | 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 Eigen::Matrix< double, 6, 1 > | Vector6d |
Private 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::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. | |
Private Attributes | |
Eigen::Matrix4f | base_transformation_ |
base transformation | |
double | gicp_epsilon_ |
The epsilon constant for gicp paper; this is NOT the convergence tolerence 0.001. | |
std::vector< Eigen::Matrix3d > | input_covariances_ |
Input cloud points covariances. | |
InputKdTreePtr | input_tree_ |
KD tree pointer of the input cloud. | |
int | k_correspondences_ |
The number of neighbors used for covariances computation. 20. | |
std::vector< Eigen::Matrix3d > | mahalanobis_ |
Mahalanobis matrices holder. | |
int | max_inner_iterations_ |
maximum number of optimizations | |
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 pcl::KdTree<PointSource> pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::InputKdTree [private] |
typedef pcl::KdTree<PointSource>::Ptr pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::InputKdTreePtr [private] |
typedef pcl::PointCloud<PointSource> pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PointCloudSource [private] |
Reimplemented from pcl::IterativeClosestPoint< PointSource, PointTarget >.
typedef PointCloudSource::ConstPtr pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PointCloudSourceConstPtr [private] |
Reimplemented from pcl::IterativeClosestPoint< PointSource, PointTarget >.
typedef PointCloudSource::Ptr pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PointCloudSourcePtr [private] |
Reimplemented from pcl::IterativeClosestPoint< PointSource, PointTarget >.
typedef pcl::PointCloud<PointTarget> pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PointCloudTarget [private] |
Reimplemented from pcl::IterativeClosestPoint< PointSource, PointTarget >.
typedef PointCloudTarget::ConstPtr pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PointCloudTargetConstPtr [private] |
Reimplemented from pcl::Registration< PointSource, PointTarget >.
typedef PointCloudTarget::Ptr pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PointCloudTargetPtr [private] |
Reimplemented from pcl::Registration< PointSource, PointTarget >.
typedef PointIndices::ConstPtr pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PointIndicesConstPtr [private] |
Reimplemented from pcl::IterativeClosestPoint< PointSource, PointTarget >.
typedef PointIndices::Ptr pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::PointIndicesPtr [private] |
Reimplemented from pcl::IterativeClosestPoint< PointSource, PointTarget >.
typedef Eigen::Matrix<double, 6, 1> pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::Vector6d [private] |
pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::GeneralizedIterativeClosestPoint | ( | ) | [inline] |
void pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::applyState | ( | Eigen::Matrix4f & | t, |
const Vector6d & | x | ||
) | const [private] |
void pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::computeCovariances | ( | typename pcl::PointCloud< PointT >::ConstPtr | cloud, |
const typename pcl::KdTree< PointT >::Ptr | tree, | ||
std::vector< Eigen::Matrix3d > & | cloud_covariances | ||
) | [private] |
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, private] |
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, private] |
bool pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::searchForNeighbors | ( | const PointSource & | query, |
std::vector< int > & | index, | ||
std::vector< float > & | distance | ||
) | [inline, private] |
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 >::setInputCloud | ( | const PointCloudSourceConstPtr & | cloud | ) | [inline] |
Provide a pointer to the input dataset.
cloud | the const boost shared pointer to a PointCloud message |
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_ [private] |
double pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::gicp_epsilon_ [private] |
std::vector<Eigen::Matrix3d> pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::input_covariances_ [private] |
InputKdTreePtr pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::input_tree_ [private] |
int pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::k_correspondences_ [private] |
std::vector<Eigen::Matrix3d> pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::mahalanobis_ [private] |
int pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::max_inner_iterations_ [private] |
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_ [private] |
std::vector<Eigen::Matrix3d> pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::target_covariances_ [private] |
const std::vector<int>* pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::tmp_idx_src_ [private] |
const std::vector<int>* pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::tmp_idx_tgt_ [private] |
const PointCloudSource* pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::tmp_src_ [private] |
const PointCloudTarget* pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::tmp_tgt_ [private] |