RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
util3d_motion_estimation.h
1/*
2Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, 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
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23ON 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
25SOFTWARE, 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>
34#include <rtabmap/core/CameraModel.h>
35
36namespace rtabmap
37{
38
39namespace util3d
40{
41
65void RTABMAP_CORE_EXPORT setRansacDeterministicSeed(bool enable);
66
68bool RTABMAP_CORE_EXPORT ransacDeterministicSeedEnabled();
69
105Transform RTABMAP_CORE_EXPORT estimateMotion3DTo2D(
106 const std::map<int, cv::Point3f> & words3A,
107 const std::map<int, cv::KeyPoint> & words2B,
108 const CameraModel & cameraModel,
109 int minInliers = 10,
110 int iterations = 100,
111 double reprojError = 5.,
112 int flagsPnP = 0,
113 int pnpRefineIterations = 1,
114 int varianceMedianRatio = 4,
115 float maxVariance = 0,
116 const Transform & guess = Transform::getIdentity(),
117 const std::map<int, cv::Point3f> & words3B = std::map<int, cv::Point3f>(),
118 cv::Mat * covariance = 0, // mean reproj error if words3B is not set
119 std::vector<int> * matchesOut = 0,
120 std::vector<int> * inliersOut = 0,
121 bool splitLinearCovarianceComponents = false);
122
157Transform RTABMAP_CORE_EXPORT estimateMotion3DTo2D(
158 const std::map<int, cv::Point3f> & words3A,
159 const std::map<int, cv::KeyPoint> & words2B,
160 const std::vector<CameraModel> & cameraModels,
161 unsigned int samplingPolicy,
162 int minInliers,
163 int iterations,
164 double reprojError,
165 int flagsPnP,
166 int refineIterations,
167 int varianceMedianRatio,
168 float maxVariance,
169 const Transform & guess,
170 const std::map<int, cv::Point3f> & words3B,
171 cv::Mat * covariance,
172 std::vector<std::vector<int> > * matchesOut,
173 std::vector<std::vector<int> > * inliersOut,
174 bool splitLinearCovarianceComponents);
179Transform RTABMAP_CORE_EXPORT estimateMotion3DTo2D(
180 const std::map<int, cv::Point3f> & words3A,
181 const std::map<int, cv::KeyPoint> & words2B,
182 const std::vector<CameraModel> & cameraModels,
183 unsigned int samplingPolicy = 0, // 0=AUTO, 1=ANY, 2=HOMOGENEOUS
184 int minInliers = 10,
185 int iterations = 100,
186 double reprojError = 5.,
187 int flagsPnP = 0,
188 int pnpRefineIterations = 1,
189 int varianceMedianRatio = 4,
190 float maxVariance = 0,
191 const Transform & guess = Transform::getIdentity(),
192 const std::map<int, cv::Point3f> & words3B = std::map<int, cv::Point3f>(),
193 cv::Mat * covariance = 0, // mean reproj error if words3B is not set
194 std::vector<int> * matchesOut = 0,
195 std::vector<int> * inliersOut = 0,
196 bool splitLinearCovarianceComponents = false);
197
219Transform RTABMAP_CORE_EXPORT estimateMotion3DTo3D(
220 const std::map<int, cv::Point3f> & words3A,
221 const std::map<int, cv::Point3f> & words3B,
222 int minInliers = 10,
223 double inliersDistance = 0.1,
224 int iterations = 100,
225 int refineIterations = 5,
226 cv::Mat * covariance = 0,
227 std::vector<int> * matchesOut = 0,
228 std::vector<int> * inliersOut = 0);
229
260void RTABMAP_CORE_EXPORT solvePnPRansac(
261 const std::vector<cv::Point3f> & objectPoints,
262 const std::vector<cv::Point2f> & imagePoints,
263 const cv::Mat & cameraMatrix,
264 const cv::Mat & distCoeffs,
265 cv::Mat & rvec,
266 cv::Mat & tvec,
267 bool useExtrinsicGuess,
268 int iterationsCount,
269 float reprojectionError,
270 int minInliersCount,
271 std::vector<int> & inliers,
272 int flags,
273 int refineIterations = 1,
274 float refineSigma = 3.0f);
275
276} // namespace util3d
277} // namespace rtabmap
278
279#endif /* UTIL3D_TRANSFORMS_H_ */
Represents a pinhole camera model containing intrinsic and extrinsic parameters, used for projection,...
Definition CameraModel.h:53
Represents a 3D rigid body transformation (rotation + translation).
Definition Transform.h:53
static Transform getIdentity()
Returns identity transform.
void RTABMAP_CORE_EXPORT setRansacDeterministicSeed(bool enable)
Toggle a deterministic seed for OpenGV's internal RANSAC RNG.
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)
Estimates the 3D rigid transformation between two sets of 3D points.
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)
Estimates a 6-DOF camera transform from 3D-2D point correspondences using PnP RANSAC.
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)
Estimates the camera pose using the PnP RANSAC algorithm and optionally refines it.
bool RTABMAP_CORE_EXPORT ransacDeterministicSeedEnabled()