RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
util3d_registration.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_REGISTRATION_H_
29#define UTIL3D_REGISTRATION_H_
30
31#include <rtabmap/core/rtabmap_core_export.h>
32
33#include <pcl/point_cloud.h>
34#include <pcl/point_types.h>
35#include <rtabmap/core/Transform.h>
36#include <opencv2/core/core.hpp>
37
38namespace rtabmap
39{
40
41namespace util3d
42{
43
44int RTABMAP_CORE_EXPORT getCorrespondencesCount(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr & cloud_source,
45 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr & cloud_target,
46 float maxDistance);
47
69 const pcl::PointCloud<pcl::PointXYZ> & cloud1,
70 const pcl::PointCloud<pcl::PointXYZ> & cloud2);
71
102 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr & cloud1,
103 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr & cloud2,
104 double inlierThreshold = 0.02,
105 int iterations = 100,
106 int refineModelIterations = 10,
107 double refineModelSigma = 3.0,
108 std::vector<int> * inliers = 0,
109 cv::Mat * variance = 0);
110
139void RTABMAP_CORE_EXPORT computeVarianceAndCorrespondences(
140 const pcl::PointCloud<pcl::PointNormal>::ConstPtr & cloudA,
141 const pcl::PointCloud<pcl::PointNormal>::ConstPtr & cloudB,
142 double maxCorrespondenceDistance,
143 double maxCorrespondenceAngle, // <=0 means that we don't care about normal angle difference
144 double & variance,
145 int & correspondencesOut,
146 bool reciprocal);
148void RTABMAP_CORE_EXPORT computeVarianceAndCorrespondences(
149 const pcl::PointCloud<pcl::PointXYZINormal>::ConstPtr & cloudA,
150 const pcl::PointCloud<pcl::PointXYZINormal>::ConstPtr & cloudB,
151 double maxCorrespondenceDistance,
152 double maxCorrespondenceAngle, // <=0 means that we don't care about normal angle difference
153 double & variance,
154 int & correspondencesOut,
155 bool reciprocal);
157void RTABMAP_CORE_EXPORT computeVarianceAndCorrespondences(
158 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr & cloudA,
159 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr & cloudB,
160 double maxCorrespondenceDistance,
161 double & variance,
162 int & correspondencesOut,
163 bool reciprocal);
165void RTABMAP_CORE_EXPORT computeVarianceAndCorrespondences(
166 const pcl::PointCloud<pcl::PointXYZI>::ConstPtr & cloudA,
167 const pcl::PointCloud<pcl::PointXYZI>::ConstPtr & cloudB,
168 double maxCorrespondenceDistance,
169 double & variance,
170 int & correspondencesOut,
171 bool reciprocal);
199Transform RTABMAP_CORE_EXPORT icp(
200 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr & cloud_source,
201 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr & cloud_target,
202 double maxCorrespondenceDistance,
203 int maximumIterations,
204 bool & hasConverged,
205 pcl::PointCloud<pcl::PointXYZ> & cloud_source_registered,
206 float epsilon = 0.0f,
207 bool icp2D = false,
208 float ransacOutlierRatio = 0.0f,
209 int * iterationsDone = nullptr);
218Transform RTABMAP_CORE_EXPORT icp(
219 const pcl::PointCloud<pcl::PointXYZI>::ConstPtr & cloud_source,
220 const pcl::PointCloud<pcl::PointXYZI>::ConstPtr & cloud_target,
221 double maxCorrespondenceDistance,
222 int maximumIterations,
223 bool & hasConverged,
224 pcl::PointCloud<pcl::PointXYZI> & cloud_source_registered,
225 float epsilon = 0.0f,
226 bool icp2D = false,
227 float ransacOutlierRatio = 0.0f,
228 int * iterationsDone = nullptr);
229
255Transform RTABMAP_CORE_EXPORT icpPointToPlane(
256 const pcl::PointCloud<pcl::PointNormal>::ConstPtr & cloud_source,
257 const pcl::PointCloud<pcl::PointNormal>::ConstPtr & cloud_target,
258 double maxCorrespondenceDistance,
259 int maximumIterations,
260 bool & hasConverged,
261 pcl::PointCloud<pcl::PointNormal> & cloud_source_registered,
262 float epsilon = 0.0f,
263 bool icp2D = false,
264 float ransacOutlierRatio = 0.0f,
265 int * iterationsDone = nullptr);
274Transform RTABMAP_CORE_EXPORT icpPointToPlane(
275 const pcl::PointCloud<pcl::PointXYZINormal>::ConstPtr & cloud_source,
276 const pcl::PointCloud<pcl::PointXYZINormal>::ConstPtr & cloud_target,
277 double maxCorrespondenceDistance,
278 int maximumIterations,
279 bool & hasConverged,
280 pcl::PointCloud<pcl::PointXYZINormal> & cloud_source_registered,
281 float epsilon = 0.0f,
282 bool icp2D = false,
283 float ransacOutlierRatio = 0.0f,
284 int * iterationsDone = nullptr);
285
286} // namespace util3d
287} // namespace rtabmap
288
289#endif /* UTIL3D_REGISTRATION_H_ */
Represents a 3D rigid body transformation (rotation + translation).
Definition Transform.h:53
void RTABMAP_CORE_EXPORT computeVarianceAndCorrespondences(const pcl::PointCloud< pcl::PointNormal >::ConstPtr &cloudA, const pcl::PointCloud< pcl::PointNormal >::ConstPtr &cloudB, double maxCorrespondenceDistance, double maxCorrespondenceAngle, double &variance, int &correspondencesOut, bool reciprocal)
Compute with variance and correspondences of pcl::PointNormal point cloud type.
Transform RTABMAP_CORE_EXPORT transformFromXYZCorrespondencesSVD(const pcl::PointCloud< pcl::PointXYZ > &cloud1, const pcl::PointCloud< pcl::PointXYZ > &cloud2)
Estimates the rigid 3D transformation between two point clouds using SVD.
Transform RTABMAP_CORE_EXPORT icpPointToPlane(const pcl::PointCloud< pcl::PointNormal >::ConstPtr &cloud_source, const pcl::PointCloud< pcl::PointNormal >::ConstPtr &cloud_target, double maxCorrespondenceDistance, int maximumIterations, bool &hasConverged, pcl::PointCloud< pcl::PointNormal > &cloud_source_registered, float epsilon=0.0f, bool icp2D=false, float ransacOutlierRatio=0.0f, int *iterationsDone=nullptr)
Performs Iterative Closest Point (ICP) alignment using a point-to-plane error metric.
Transform RTABMAP_CORE_EXPORT transformFromXYZCorrespondences(const pcl::PointCloud< pcl::PointXYZ >::ConstPtr &cloud1, const pcl::PointCloud< pcl::PointXYZ >::ConstPtr &cloud2, double inlierThreshold=0.02, int iterations=100, int refineModelIterations=10, double refineModelSigma=3.0, std::vector< int > *inliers=0, cv::Mat *variance=0)
Estimates a rigid transformation between two point clouds using RANSAC with optional refinement.
Transform RTABMAP_CORE_EXPORT icp(const pcl::PointCloud< pcl::PointXYZ >::ConstPtr &cloud_source, const pcl::PointCloud< pcl::PointXYZ >::ConstPtr &cloud_target, double maxCorrespondenceDistance, int maximumIterations, bool &hasConverged, pcl::PointCloud< pcl::PointXYZ > &cloud_source_registered, float epsilon=0.0f, bool icp2D=false, float ransacOutlierRatio=0.0f, int *iterationsDone=nullptr)
Performs Iterative Closest Point (ICP) alignment between two point clouds and returns the resulting t...