Main MRPT website > C++ reference for MRPT 1.9.9
se3.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <mrpt/utils/utils_defs.h>
12 #include <mrpt/math/math_frwds.h>
14 #include <mrpt/poses/CPose3DQuat.h>
16 #include <mrpt/poses/poses_frwds.h>
18 
19 namespace mrpt
20 {
21 namespace tfest
22 {
23 /** \addtogroup mrpt_tfest_grp
24  * @{ */
25 
26 /** Least-squares (L2 norm) solution to finding the optimal SE(3) transform
27  * between two reference frames using the "quaternion" or Horn's method:
28  * - "Closed-form solution of absolute orientation using unit quaternions",
29  * BKP Horn, Journal of the Optical Society of America, 1987.
30  *
31  * The optimal transformation `q` fulfills \f$ p_{this} = q \oplus p_{other}
32  * \f$, that is, the
33  * transformation of frame `other` with respect to `this`.
34  *
35  * \image html tfest_frames.png
36  *
37  * \param[in] in_correspondences The coordinates of the input points for the
38  * two coordinate systems "this" and "other"
39  * \param[out] out_transform The output transformation
40  * \param[out] out_scale The computed scale of the optimal
41  * transformation (will be 1.0 for a perfectly rigid translation + rotation).
42  * \param[in] forceScaleToUnity Whether or not force the scale employed to
43  * rotate the coordinate systems to one (rigid transformation)
44  * \note [New in MRPT 1.3.0] This function replaces
45  * mrpt::scanmatching::leastSquareErrorRigidTransformation6DRANSAC() and
46  * mrpt::scanmatching::HornMethod()
47  * \sa se2_l2, se3_l2_robust
48  */
49 bool se3_l2(
50  const mrpt::utils::TMatchingPairList& in_correspondences,
51  mrpt::poses::CPose3DQuat& out_transform, double& out_scale,
52  bool forceScaleToUnity = false);
53 
54 /** \overload
55  *
56  * This version accepts corresponding points as two vectors of TPoint3D (must
57  * have identical length).
58  */
59 bool se3_l2(
60  const std::vector<mrpt::math::TPoint3D>& in_points_this,
61  const std::vector<mrpt::math::TPoint3D>& in_points_other,
62  mrpt::poses::CPose3DQuat& out_transform, double& out_scale,
63  bool forceScaleToUnity = false);
64 
65 /** Parameters for se3_l2_robust(). See function for more details */
67 {
68  /** (Default=5) The minimum amount of points in a set to start a consensus
69  * set. \sa ransac_maxSetSizePct */
70  unsigned int ransac_minSetSize;
71  /** (Default=50) The maximum number of iterations of the RANSAC algorithm */
72  unsigned int ransac_nmaxSimulations;
73  /** (Default=0.5) The minimum ratio (0.0 - 1.0) of the input set that is
74  * considered to be inliers. *Important*: The minimum size of a consensus
75  * set to be accepted will be "INPUT_CORRESPONDENCES*ransac_maxSetSizePct".
76  */
78  /** (Default=0.05) The maximum distance in X,Y,Z for a solution to be
79  * considered as matching a candidate solution (In meters) */
81  /** (Default=1 deg) The maximum angle (yaw,pitch,roll) for a solution to be
82  * considered as matching a candidate solution (In radians) */
84  /** (Default=0.03) The maximum difference in scale for a solution to be
85  * considered as matching a candidate solution (dimensionless) */
87  /** (Default=true) */
89  /** (Default=false) */
90  bool verbose;
91 
92  /** If provided, this user callback will be invoked to determine the
93  * individual compatibility between each potential pair
94  * of elements. Can check image descriptors, geometrical properties, etc.
95  * \return Must return true if the pair is a potential match, false
96  * otherwise.
97  */
98  // std::function<bool(TPotentialMatch)> user_individual_compat_callback; //
99  // This could be used in the future when we enforce C++11 to users...
101 
103  : ransac_minSetSize(5),
106  ransac_threshold_lin(0.05),
107  ransac_threshold_ang(mrpt::utils::DEG2RAD(1)),
109  forceScaleToUnity(true),
110  verbose(false)
111  {
112  }
113 };
114 
115 /** Output placeholder for se3_l2_robust() */
117 {
118  /** The best transformation found */
120  /** The estimated scale of the rigid transformation (should be very close to
121  * 1.0) */
122  double scale;
123  /** Indexes within the `in_correspondences` list which corresponds with
124  * inliers */
126 
128 };
129 
130 /** Least-squares (L2 norm) solution to finding the optimal SE(3) transform
131  * between two reference frames using RANSAC and the "quaternion" or Horn's
132  * method:
133  * - "Closed-form solution of absolute orientation using unit quaternions",
134  * BKP Horn, Journal of the Optical Society of America, 1987.
135  *
136  * The optimal transformation `q` fulfills \f$ p_{this} = q \oplus p_{other}
137  * \f$, that is, the
138  * transformation of frame `other` with respect to `this`.
139  *
140  * \image html tfest_frames.png
141  *
142  * \param[in] in_correspondences The set of correspondences.
143  * \param[in] in_params Method parameters (see docs for TSE3RobustParams)
144  * \param[out] out_results Results: transformation, scale, etc.
145  *
146  * \return True if the minimum number of correspondences was found, false
147  * otherwise.
148  * \note Implemented by FAMD, 2008. Re-factored by JLBC, 2015.
149  * \note [New in MRPT 1.3.0] This function replaces
150  * mrpt::scanmatching::leastSquareErrorRigidTransformation6DRANSAC()
151  * \sa se2_l2, se3_l2
152  */
153 bool se3_l2_robust(
154  const mrpt::utils::TMatchingPairList& in_correspondences,
155  const TSE3RobustParams& in_params, TSE3RobustResult& out_results);
156 
157 /** @} */ // end of grouping
158 }
159 
160 } // End of namespace
double ransac_maxSetSizePct
(Default=0.5) The minimum ratio (0.0 - 1.0) of the input set that is considered to be inliers...
Definition: se3.h:77
bool se3_l2_robust(const mrpt::utils::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().
Definition: se3.h:66
std::function< bool(const TPotentialMatch &)> TFunctorCheckPotentialMatch
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:6502
bool forceScaleToUnity
(Default=true)
Definition: se3.h:88
bool verbose
(Default=false)
Definition: se3.h:90
unsigned int ransac_nmaxSimulations
(Default=50) The maximum number of iterations of the RANSAC algorithm
Definition: se3.h:72
double ransac_threshold_ang
(Default=1 deg) The maximum angle (yaw,pitch,roll) for a solution to be considered as matching a cand...
Definition: se3.h:83
mrpt::vector_int inliers_idx
Indexes within the in_correspondences list which corresponds with inliers.
Definition: se3.h:125
A list of TMatchingPair.
Definition: TMatchingPair.h:93
bool se3_l2(const mrpt::utils::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 ...
Definition: se3_l2.cpp:223
double scale
The estimated scale of the rigid transformation (should be very close to 1.0)
Definition: se3.h:122
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).
Definition: CPose3DQuat.h:48
#define DEG2RAD
double ransac_threshold_scale
(Default=0.03) The maximum difference in scale for a solution to be considered as matching a candidat...
Definition: se3.h:86
TFunctorCheckPotentialMatch user_individual_compat_callback
If provided, this user callback will be invoked to determine the individual compatibility between eac...
Definition: se3.h:100
double ransac_threshold_lin
(Default=0.05) The maximum distance in X,Y,Z for a solution to be considered as matching a candidate ...
Definition: se3.h:80
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned int ransac_minSetSize
(Default=5) The minimum amount of points in a set to start a consensus set.
Definition: se3.h:70
mrpt::poses::CPose3DQuat transformation
The best transformation found.
Definition: se3.h:119
Output placeholder for se3_l2_robust()
Definition: se3.h:116
std::vector< int32_t > vector_int



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019