util3d_motion_estimation.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef UTIL3D_MOTION_ESTIMATION_H_
29 #define UTIL3D_MOTION_ESTIMATION_H_
30 
31 #include <rtabmap/core/rtabmap_core_export.h>
32 
33 #include <rtabmap/core/Transform.h>
35 
36 namespace rtabmap
37 {
38 
39 namespace util3d
40 {
41 
42 Transform RTABMAP_CORE_EXPORT estimateMotion3DTo2D(
43  const std::map<int, cv::Point3f> & words3A,
44  const std::map<int, cv::KeyPoint> & words2B,
45  const CameraModel & cameraModel,
46  int minInliers = 10,
47  int iterations = 100,
48  double reprojError = 5.,
49  int flagsPnP = 0,
50  int pnpRefineIterations = 1,
51  int varianceMedianRatio = 4,
52  float maxVariance = 0,
53  const Transform & guess = Transform::getIdentity(),
54  const std::map<int, cv::Point3f> & words3B = std::map<int, cv::Point3f>(),
55  cv::Mat * covariance = 0, // mean reproj error if words3B is not set
56  std::vector<int> * matchesOut = 0,
57  std::vector<int> * inliersOut = 0,
58  bool splitLinearCovarianceComponents = false);
59 
60 Transform RTABMAP_CORE_EXPORT estimateMotion3DTo2D(
61  const std::map<int, cv::Point3f> & words3A,
62  const std::map<int, cv::KeyPoint> & words2B,
63  const std::vector<CameraModel> & cameraModels,
64  unsigned int samplingPolicy = 0, // 0=AUTO, 1=ANY, 2=HOMOGENEOUS
65  int minInliers = 10,
66  int iterations = 100,
67  double reprojError = 5.,
68  int flagsPnP = 0,
69  int pnpRefineIterations = 1,
70  int varianceMedianRatio = 4,
71  float maxVariance = 0,
72  const Transform & guess = Transform::getIdentity(),
73  const std::map<int, cv::Point3f> & words3B = std::map<int, cv::Point3f>(),
74  cv::Mat * covariance = 0, // mean reproj error if words3B is not set
75  std::vector<int> * matchesOut = 0,
76  std::vector<int> * inliersOut = 0,
77  bool splitLinearCovarianceComponents = false);
78 
79 Transform estimateMotion3DTo2D(
80  const std::map<int, cv::Point3f> & words3A,
81  const std::map<int, cv::KeyPoint> & words2B,
82  const std::vector<CameraModel> & cameraModels,
83  unsigned int samplingPolicy,
84  int minInliers,
85  int iterations,
86  double reprojError,
87  int flagsPnP,
88  int refineIterations,
89  int varianceMedianRatio,
90  float maxVariance,
91  const Transform & guess,
92  const std::map<int, cv::Point3f> & words3B,
93  cv::Mat * covariance,
94  std::vector<std::vector<int> > * matchesOut,
95  std::vector<std::vector<int> > * inliersOut,
96  bool splitLinearCovarianceComponents);
97 
98 Transform RTABMAP_CORE_EXPORT estimateMotion3DTo3D(
99  const std::map<int, cv::Point3f> & words3A,
100  const std::map<int, cv::Point3f> & words3B,
101  int minInliers = 10,
102  double inliersDistance = 0.1,
103  int iterations = 100,
104  int refineIterations = 5,
105  cv::Mat * covariance = 0,
106  std::vector<int> * matchesOut = 0,
107  std::vector<int> * inliersOut = 0);
108 
109 void RTABMAP_CORE_EXPORT solvePnPRansac(
110  const std::vector<cv::Point3f> & objectPoints,
111  const std::vector<cv::Point2f> & imagePoints,
112  const cv::Mat & cameraMatrix,
113  const cv::Mat & distCoeffs,
114  cv::Mat & rvec,
115  cv::Mat & tvec,
116  bool useExtrinsicGuess,
117  int iterationsCount,
118  float reprojectionError,
119  int minInliersCount,
120  std::vector<int> & inliers,
121  int flags,
122  int refineIterations = 1,
123  float refineSigma = 3.0f);
124 
125 } // namespace util3d
126 } // namespace rtabmap
127 
128 #endif /* UTIL3D_TRANSFORMS_H_ */
rtabmap::Transform::getIdentity
static Transform getIdentity()
Definition: Transform.cpp:411
Transform.h
rtabmap::util3d::solvePnPRansac
void RTABMAP_CORE_EXPORT solvePnPRansac(const std::vector< cv::Point3f > &objectPoints, const std::vector< cv::Point2f > &imagePoints, const cv::Mat &cameraMatrix, const cv::Mat &distCoeffs, cv::Mat &rvec, cv::Mat &tvec, bool useExtrinsicGuess, int iterationsCount, float reprojectionError, int minInliersCount, std::vector< int > &inliers, int flags, int refineIterations=1, float refineSigma=3.0f)
Definition: util3d_motion_estimation.cpp:843
rtabmap::util3d::estimateMotion3DTo3D
Transform RTABMAP_CORE_EXPORT estimateMotion3DTo3D(const std::map< int, cv::Point3f > &words3A, const std::map< int, cv::Point3f > &words3B, int minInliers=10, double inliersDistance=0.1, int iterations=100, int refineIterations=5, cv::Mat *covariance=0, std::vector< int > *matchesOut=0, std::vector< int > *inliersOut=0)
Definition: util3d_motion_estimation.cpp:730
rtabmap::util3d::estimateMotion3DTo2D
Transform RTABMAP_CORE_EXPORT estimateMotion3DTo2D(const std::map< int, cv::Point3f > &words3A, const std::map< int, cv::KeyPoint > &words2B, const CameraModel &cameraModel, int minInliers=10, int iterations=100, double reprojError=5., int flagsPnP=0, int pnpRefineIterations=1, int varianceMedianRatio=4, float maxVariance=0, const Transform &guess=Transform::getIdentity(), const std::map< int, cv::Point3f > &words3B=std::map< int, cv::Point3f >(), cv::Mat *covariance=0, std::vector< int > *matchesOut=0, std::vector< int > *inliersOut=0, bool splitLinearCovarianceComponents=false)
Definition: util3d_motion_estimation.cpp:59
CameraModel.h
rtabmap
Definition: CameraARCore.cpp:35


rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Apr 28 2025 02:46:07