Go to the documentation of this file.
38 const size_t N = in_correspondences.size();
43 Eigen::Matrix<double, 7, 1> th;
46 th[2] =
params.ransac_threshold_lin;
49 th[5] =
params.ransac_threshold_ang;
50 th[6] =
params.ransac_threshold_scale;
56 std::numeric_limits<double>::max();
63 N *
params.ransac_maxSetSizePct);
66 params.ransac_nmaxSimulations;
70 "Minimum number of points to be considered a good set is < Minimum "
71 "number of points to fit the model");
76 for (
size_t iterations = 0; iterations < max_it; iterations++)
81 std::vector<uint32_t> rub, mbSet, cSet;
88 for (
size_t i = 0; mbInliers.size() <
n && i < N; i++)
90 const size_t idx = mbSet[i];
93 if (
params.user_individual_compat_callback)
96 pm.
idx_this = in_correspondences[idx].this_idx;
97 pm.
idx_other = in_correspondences[idx].other_idx;
98 if (!
params.user_individual_compat_callback(pm))
102 mbInliers.push_back(in_correspondences[idx]);
110 std::cerr <<
"[tfest::se3_l2_robust] Iter " << iterations
111 <<
": It was not possible to find the min no of "
112 "(compatible) matching pairs.\n";
118 mbInliers, mbOutQuat,
scale,
params.forceScaleToUnity);
121 std::cerr <<
"[tfest::se3_l2_robust] tfest::se3_l2() returned "
122 "false for tentative subset during RANSAC "
130 mbOut_vec[0] = mbOut.
x();
131 mbOut_vec[1] = mbOut.
y();
132 mbOut_vec[2] = mbOut.z();
134 mbOut_vec[3] = mbOut.
yaw();
135 mbOut_vec[4] = mbOut.
pitch();
136 mbOut_vec[5] = mbOut.
roll();
138 mbOut_vec[6] =
scale;
141 for (
size_t k =
n; k < N; k++)
143 const size_t idx = mbSet[k];
146 if (
params.user_individual_compat_callback)
149 pm.
idx_this = in_correspondences[idx].this_idx;
150 pm.
idx_other = in_correspondences[idx].other_idx;
151 if (!
params.user_individual_compat_callback(pm))
157 mbInliers.push_back(in_correspondences[idx]);
159 mbInliers, csOutQuat,
scale,
params.forceScaleToUnity);
160 mbInliers.erase(mbInliers.end() - 1);
164 std::cerr <<
"[tfest::se3_l2_robust] tfest::se3_l2() returned "
165 "false for tentative subset during RANSAC "
173 if (fabs(mbOut_vec[0] - csOut.
x()) < th[0] &&
174 fabs(mbOut_vec[1] - csOut.
y()) < th[1] &&
175 fabs(mbOut_vec[2] - csOut.z()) < th[2] &&
176 fabs(mbOut_vec[3] - csOut.
yaw()) < th[3] &&
177 fabs(mbOut_vec[4] - csOut.
pitch()) < th[4] &&
178 fabs(mbOut_vec[5] - csOut.
roll()) < th[5] &&
179 fabs(mbOut_vec[6] -
scale) < th[6])
192 if (cSet.size() >= d)
196 cSetInliers.resize(cSet.size());
197 for (
unsigned int m = 0; m < cSet.size(); m++)
198 cSetInliers[m] = in_correspondences[cSet[m]];
203 cSetInliers, cIOutQuat,
scale,
204 params.forceScaleToUnity);
207 "tfest::se3_l2() returned false for tentative subset during "
208 "RANSAC iteration!");
212 const double err = std::sqrt(
213 square(mbOut_vec[0] - cIOut.
x()) +
214 square(mbOut_vec[1] - cIOut.
y()) +
215 square(mbOut_vec[2] - cIOut.z()) +
222 if (err < min_err && cSet.size() >= max_size)
225 max_size = cSet.size();
226 results.transformation = cIOutQuat;
242 std::cerr <<
"[se3_l2_robust] maximum size is == 0!\n";
bool se3_l2_robust(const mrpt::tfest::TMatchingPairList &in_correspondences, const TSE3RobustParams &in_params, TSE3RobustResult &out_results)
Least-squares (L2 norm) solution to finding the optimal SE(3) transform between two reference frames ...
Parameters for se3_l2_robust().
double pitch() const
Get the PITCH angle (in radians)
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction.
Functions for estimating the optimal transformation between two frames of references given measuremen...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,...
T square(const T x)
Inline function for the square of a number.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
map< string, CVectorDouble > results
For each individual-compatibility (IC) test, the indices of the candidate match between elements in b...
int round(const T value)
Returns the closer integer (int) to x.
void linspace(T first, T last, size_t count, VECTOR &out_vector)
Generates an equidistant sequence of numbers given the first one, the last one and the desired number...
double x() const
Common members of all points & poses classes.
bool se3_l2(const mrpt::tfest::TMatchingPairList &in_correspondences, mrpt::poses::CPose3DQuat &out_transform, double &out_scale, bool forceScaleToUnity=false)
Least-squares (L2 norm) solution to finding the optimal SE(3) transform between two reference frames ...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
double roll() const
Get the ROLL angle (in radians)
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
GLenum GLenum GLenum GLenum GLenum scale
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.
double yaw() const
Get the YAW angle (in radians)
Output placeholder for se3_l2_robust()
void permuteVector(const VEC &in_vector, VEC &out_result)
Returns a random permutation of a vector: all the elements of the input vector are in the output but ...
This base provides a set of functions for maths stuff.
A namespace of pseudo-random numbers generators of diferent distributions.
GLenum const GLfloat * params
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at mié 12 jul 2023 10:03:34 CEST | |