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)
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_ double getTranslationThreshold() const
Get the rotation threshold cosine angle (maximum allowable difference between two consecutive transfo...
int getMaximumIterations() const
Get the maximum number of iterations the internal optimization should run for, as set by the user.
double correspondences_cur_mse_
The MSE for the current set of correspondences.
const Matrix4 & transformation_
The current transformation obtained by the transformation estimation method.
ConvergenceCriteria represents an abstract base class for different convergence criteria used in regi...
Eigen::Matrix< Scalar, 4, 4 > Matrix4
DefaultConvergenceCriteria represents an instantiation of ConvergenceCriteria, and implements the fol...
void setFailureAfterMaximumIterations(const bool failure_after_max_iter)
Specifies 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,...
double getRelativeMSE() const
Get the relative MSE between two consecutive sets of correspondences.
double mse_threshold_absolute_
The absolute change from the previous 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.
double rotation_threshold_
The rotation threshold is the relative rotation between two iterations (as angle cosine).
double mse_threshold_relative_
The relative change from the previous MSE for the current set of correspondences, e....
void setMaximumIterations(const int nr_iterations)
Set the maximum number of iterations the internal optimization should run for.
int getMaximumIterationsSimilarTransforms() const
Get the maximum number of iterations that the internal rotation, translation, and MSE differences are...
virtual bool hasConverged()
Check if convergence has been reached.
double calculateMSE(const pcl::Correspondences &correspondences) const
Calculate the mean squared error (MSE) of the distance for a given set of correspondences.
DefaultConvergenceCriteria(const int &iterations, const Matrix4 &transform, const pcl::Correspondences &correspondences)
Empty constructor.
void setRelativeMSE(const double mse_relative)
Set the relative MSE between two consecutive sets of correspondences.
virtual ~DefaultConvergenceCriteria()
Empty destructor.
int max_iterations_
The maximum nuyyGmber of iterations that the registration loop is to be executed.
const pcl::Correspondences & correspondences_
The current set of point correspondences between the source and the target.
const int & iterations_
The number of iterations done by the registration loop so far.
double correspondences_prev_mse_
The MSE for the previous set of correspondences.
std::vector< pcl::Correspondence, Eigen::aligned_allocator< pcl::Correspondence > > Correspondences
float distance(const PointT &p1, const PointT &p2)
void setConvergenceState(ConvergenceState c)
Sets the convergence state externally (for example, when ICP does not find enough correspondences to ...
ConvergenceState getConvergenceState()
Return the convergence state after hasConverged ()
boost::shared_ptr< const DefaultConvergenceCriteria< Scalar > > ConstPtr
boost::shared_ptr< DefaultConvergenceCriteria< Scalar > > Ptr
void setTranslationThreshold(const double threshold)
Set the translation threshold (maximum allowable difference between two consecutive transformations) ...
void setRotationThreshold(const double threshold)
Set 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.
double translation_threshold_
The translation threshold is the relative translation between two iterations (0 if no translation).
ConvergenceState convergence_state_
The state of the convergence (e.g., why did the registration converge).
int max_iterations_similar_transforms_
The maximum number of iterations that the internal rotation, translation, and MSE differences are all...
bool getFailureAfterMaximumIterations() const
Get whether the registration will fail or converge when the maximum number of iterations is reached.
void setMaximumIterationsSimilarTransforms(const int nr_iterations)
Set the maximum number of iterations that the internal rotation, translation, and MSE differences are...
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.