RTAB-Map 0.23.12
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
65 const pcl::PointCloud<pcl::PointXYZ> & cloud1,
66 const pcl::PointCloud<pcl::PointXYZ> & cloud2);
67
98 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr & cloud1,
99 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr & cloud2,
100 double inlierThreshold = 0.02,
101 int iterations = 100,
102 int refineModelIterations = 10,
103 double refineModelSigma = 3.0,
104 std::vector<int> * inliers = 0,
105 cv::Mat * variance = 0);
106
135void RTABMAP_CORE_EXPORT computeVarianceAndCorrespondences(
136 const pcl::PointCloud<pcl::PointNormal>::ConstPtr & cloudA,
137 const pcl::PointCloud<pcl::PointNormal>::ConstPtr & cloudB,
138 double maxCorrespondenceDistance,
139 double maxCorrespondenceAngle, // <=0 means that we don't care about normal angle difference
140 double & variance,
141 int & correspondencesOut,
142 bool reciprocal);
144void RTABMAP_CORE_EXPORT computeVarianceAndCorrespondences(
145 const pcl::PointCloud<pcl::PointXYZINormal>::ConstPtr & cloudA,
146 const pcl::PointCloud<pcl::PointXYZINormal>::ConstPtr & cloudB,
147 double maxCorrespondenceDistance,
148 double maxCorrespondenceAngle, // <=0 means that we don't care about normal angle difference
149 double & variance,
150 int & correspondencesOut,
151 bool reciprocal);
153void RTABMAP_CORE_EXPORT computeVarianceAndCorrespondences(
154 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr & cloudA,
155 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr & cloudB,
156 double maxCorrespondenceDistance,
157 double & variance,
158 int & correspondencesOut,
159 bool reciprocal);
161void RTABMAP_CORE_EXPORT computeVarianceAndCorrespondences(
162 const pcl::PointCloud<pcl::PointXYZI>::ConstPtr & cloudA,
163 const pcl::PointCloud<pcl::PointXYZI>::ConstPtr & cloudB,
164 double maxCorrespondenceDistance,
165 double & variance,
166 int & correspondencesOut,
167 bool reciprocal);
195Transform RTABMAP_CORE_EXPORT icp(
196 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr & cloud_source,
197 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr & cloud_target,
198 double maxCorrespondenceDistance,
199 int maximumIterations,
200 bool & hasConverged,
201 pcl::PointCloud<pcl::PointXYZ> & cloud_source_registered,
202 float epsilon = 0.0f,
203 bool icp2D = false,
204 float ransacOutlierRatio = 0.0f,
205 int * iterationsDone = nullptr);
214Transform RTABMAP_CORE_EXPORT icp(
215 const pcl::PointCloud<pcl::PointXYZI>::ConstPtr & cloud_source,
216 const pcl::PointCloud<pcl::PointXYZI>::ConstPtr & cloud_target,
217 double maxCorrespondenceDistance,
218 int maximumIterations,
219 bool & hasConverged,
220 pcl::PointCloud<pcl::PointXYZI> & cloud_source_registered,
221 float epsilon = 0.0f,
222 bool icp2D = false,
223 float ransacOutlierRatio = 0.0f,
224 int * iterationsDone = nullptr);
225
251Transform RTABMAP_CORE_EXPORT icpPointToPlane(
252 const pcl::PointCloud<pcl::PointNormal>::ConstPtr & cloud_source,
253 const pcl::PointCloud<pcl::PointNormal>::ConstPtr & cloud_target,
254 double maxCorrespondenceDistance,
255 int maximumIterations,
256 bool & hasConverged,
257 pcl::PointCloud<pcl::PointNormal> & cloud_source_registered,
258 float epsilon = 0.0f,
259 bool icp2D = false,
260 float ransacOutlierRatio = 0.0f,
261 int * iterationsDone = nullptr);
270Transform RTABMAP_CORE_EXPORT icpPointToPlane(
271 const pcl::PointCloud<pcl::PointXYZINormal>::ConstPtr & cloud_source,
272 const pcl::PointCloud<pcl::PointXYZINormal>::ConstPtr & cloud_target,
273 double maxCorrespondenceDistance,
274 int maximumIterations,
275 bool & hasConverged,
276 pcl::PointCloud<pcl::PointXYZINormal> & cloud_source_registered,
277 float epsilon = 0.0f,
278 bool icp2D = false,
279 float ransacOutlierRatio = 0.0f,
280 int * iterationsDone = nullptr);
281
282} // namespace util3d
283} // namespace rtabmap
284
285#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...