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 RTABMAP_CORE_EXPORT estimateMotion3DTo3D(
80  const std::map<int, cv::Point3f> & words3A,
81  const std::map<int, cv::Point3f> & words3B,
82  int minInliers = 10,
83  double inliersDistance = 0.1,
84  int iterations = 100,
85  int refineIterations = 5,
86  cv::Mat * covariance = 0,
87  std::vector<int> * matchesOut = 0,
88  std::vector<int> * inliersOut = 0);
89 
90 void RTABMAP_CORE_EXPORT solvePnPRansac(
91  const std::vector<cv::Point3f> & objectPoints,
92  const std::vector<cv::Point2f> & imagePoints,
93  const cv::Mat & cameraMatrix,
94  const cv::Mat & distCoeffs,
95  cv::Mat & rvec,
96  cv::Mat & tvec,
97  bool useExtrinsicGuess,
98  int iterationsCount,
99  float reprojectionError,
100  int minInliersCount,
101  std::vector<int> & inliers,
102  int flags,
103  int refineIterations = 1,
104  float refineSigma = 3.0f);
105 
106 } // namespace util3d
107 } // namespace rtabmap
108 
109 #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:779
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:666
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 Jul 1 2024 02:42:41