40 #ifndef PCL_REGISTRATION_DEFAULT_CONVERGENCE_CRITERIA_H_
41 #define PCL_REGISTRATION_DEFAULT_CONVERGENCE_CRITERIA_H_
43 #include <pcl/registration/eigen.h>
44 #include <pcl/correspondence.h>
45 #include <pcl/registration/convergence_criteria.h>
49 namespace registration
64 template <
typename Scalar =
float>
68 typedef boost::shared_ptr<DefaultConvergenceCriteria<Scalar> >
Ptr;
69 typedef boost::shared_ptr<const DefaultConvergenceCriteria<Scalar> >
ConstPtr;
71 typedef Eigen::Matrix<Scalar, 4, 4>
Matrix4;
222 for (
size_t i = 0; i < correspondences.size (); ++i)
223 mse += correspondences[i].distance;
224 mse /= double (correspondences.size ());
273 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
278 #include <pcl/registration/impl/default_convergence_criteria.hpp>
280 #endif // PCL_REGISTRATION_DEFAULT_CONVERGENCE_CRITERIA_H_
DefaultConvergenceCriteria(const int &iterations, const Matrix4 &transform, const pcl::Correspondences &correspondences)
Empty constructor.
Eigen::Matrix< Scalar, 4, 4 > Matrix4
double mse_threshold_absolute_
The absolute change from the previous MSE for the current set of correspondences. ...
double mse_threshold_relative_
The relative change from the previous MSE for the current set of correspondences, e...
DefaultConvergenceCriteria represents an instantiation of ConvergenceCriteria, and implements the fol...
int max_iterations_
The maximum nuyyGmber of iterations that the registration loop is to be executed. ...
const Matrix4 & transformation_
The current transformation obtained by the transformation estimation method.
double calculateMSE(const pcl::Correspondences &correspondences) const
Calculate the mean squared error (MSE) of the distance for a given set of correspondences.
bool getFailureAfterMaximumIterations() const
Get whether the registration will fail or converge when the maximum number of iterations is reached...
ConvergenceCriteria represents an abstract base class for different convergence criteria used in regi...
ConvergenceState getConvergenceState()
Return the convergence state after hasConverged ()
void setTranslationThreshold(const double threshold)
Set the translation threshold (maximum allowable difference between two consecutive transformations) ...
ConvergenceState convergence_state_
The state of the convergence (e.g., why did the registration converge).
void setMaximumIterationsSimilarTransforms(const int nr_iterations)
Set the maximum number of iterations that the internal rotation, translation, and MSE differences are...
int getMaximumIterationsSimilarTransforms() const
Get the maximum number of iterations that the internal rotation, translation, and MSE differences are...
void setRotationThreshold(const double threshold)
Set the rotation threshold cosine angle (maximum allowable difference between two consecutive transfo...
double getTranslationThreshold() const
Get the rotation threshold cosine angle (maximum allowable difference between two consecutive transfo...
void setAbsoluteMSE(const double mse_absolute)
Set the absolute MSE between two consecutive sets of correspondences.
void setMaximumIterations(const int nr_iterations)
Set the maximum number of iterations the internal optimization should run for.
void setFailureAfterMaximumIterations(const bool failure_after_max_iter)
Specifies if the registration fails or converges when the maximum number of iterations is reached...
void setConvergenceState(ConvergenceState c)
Sets the convergence state externally (for example, when ICP does not find enough correspondences to ...
double rotation_threshold_
The rotation threshold is the relative rotation between two iterations (as angle cosine).
const pcl::Correspondences & correspondences_
The current set of point correspondences between the source and the target.
virtual bool hasConverged()
Check if convergence has been reached.
virtual ~DefaultConvergenceCriteria()
Empty destructor.
std::vector< pcl::Correspondence, Eigen::aligned_allocator< pcl::Correspondence > > Correspondences
double correspondences_prev_mse_
The MSE for the previous set of correspondences.
int getMaximumIterations() const
Get the maximum number of iterations the internal optimization should run for, as set by the user...
void setRelativeMSE(const double mse_relative)
Set the relative MSE between two consecutive sets of correspondences.
double getRelativeMSE() const
Get the relative MSE between two consecutive sets of correspondences.
const int & iterations_
The number of iterations done by the registration loop so far.
boost::shared_ptr< const DefaultConvergenceCriteria< Scalar > > ConstPtr
double correspondences_cur_mse_
The MSE for the current set of correspondences.
bool failure_after_max_iter_
Specifys if the registration fails or converges when the maximum number of iterations is reached...
int iterations_similar_transforms_
Internal counter for the number of iterations that the internal rotation, translation, and MSE differences are allowed to be similar.
double getRotationThreshold() const
Get the rotation threshold cosine angle (maximum allowable difference between two consecutive transfo...
double getAbsoluteMSE() const
Get the absolute MSE between two consecutive sets of correspondences.
int max_iterations_similar_transforms_
The maximum number of iterations that the internal rotation, translation, and MSE differences are all...
double translation_threshold_
The translation threshold is the relative translation between two iterations (0 if no translation)...
boost::shared_ptr< DefaultConvergenceCriteria< Scalar > > Ptr