43 const size_t N = in_correspondences.size();
45 const float N_inv = 1.0f / N;
48 float SumXa = 0, SumXb = 0, SumYa = 0, SumYb = 0;
49 float Sxx = 0, Sxy = 0, Syx = 0, Syy = 0;
51 for (
const auto& p : in_correspondences)
54 const float xa = p.this_x;
55 const float ya = p.this_y;
56 const float xb = p.other_x;
57 const float yb = p.other_y;
79 ret.
Ax = N * (Sxx + Syy) - SumXa * SumXb - SumYa * SumYb;
80 ret.
Ay = SumXa * SumYb + N * (Syx - Sxy) - SumXb * SumYa;
98 const size_t N = in_correspondences.size();
100 if (N < 2)
return false;
102 const float N_inv = 1.0f / N;
119 #if MRPT_ARCH_INTEL_COMPATIBLE 122 implRet = mrpt::tfest::internal::se2_l2_impl_SSE2(in_correspondences);
130 out_transformation.
phi = (implRet.
Ax != 0 || implRet.
Ay != 0)
132 static_cast<double>(implRet.
Ay),
133 static_cast<double>(implRet.
Ax))
136 const double ccos = cos(out_transformation.
phi);
137 const double csin = sin(out_transformation.
phi);
139 out_transformation.
x =
141 out_transformation.
y =
144 if (out_estimateCovariance)
150 double var_x_a = 0, var_y_a = 0, var_x_b = 0, var_y_b = 0;
151 const double N_1_inv = 1.0 / (N - 1);
155 for (
const auto& in_correspondence : in_correspondences)
169 const double BETA = (var_x_a + var_y_a + var_x_b + var_y_b) *
170 pow(static_cast<double>(N), 2.0) *
171 static_cast<double>(N - 1);
179 (*C)(0, 0) = 2.0 * N_inv + BETA *
square(
183 (*C)(1, 1) = 2.0 * N_inv + BETA *
square(
187 (*C)(2, 2) = BETA / D;
189 (*C)(0, 1) = (*C)(1, 0) =
195 (*C)(0, 2) = (*C)(2, 0) =
200 (*C)(1, 2) = (*C)(2, 1) =
CPose2D mean
The mean value.
bool se2_l2(const mrpt::tfest::TMatchingPairList &in_correspondences, mrpt::math::TPose2D &out_transformation, mrpt::math::CMatrixDouble33 *out_estimateCovariance=nullptr)
Least-squares (L2 norm) solution to finding the optimal SE(2) (x,y,yaw) between two reference frames...
static mrpt::tfest::internal::se2_l2_impl_return_t< float > se2_l2_impl(const TMatchingPairList &in_correspondences)
mrpt::math::CMatrixDouble33 cov
The 3x3 covariance matrix.
bool supports(feature f) noexcept
Returns true if the current CPU (and OS) supports the given CPU feature.
#define ASSERT_(f)
Defines an assertion mechanism.
This base provides a set of functions for maths stuff.
Declares a class that represents a Probability Density function (PDF) of a 2D pose ...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
return_t square(const num_t x)
Inline function for the square of a number.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
Functions for estimating the optimal transformation between two frames of references given measuremen...
double phi
Orientation (rads)