RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
util3d_correspondences.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_CORRESPONDENCES_H_
29#define UTIL3D_CORRESPONDENCES_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 <opencv2/core/version.hpp>
36#if CV_MAJOR_VERSION < 5
37#include <opencv2/features2d/features2d.hpp>
38#else
39#include <opencv2/features.hpp>
40#endif
41#include <set>
42#include <map>
43#include <list>
44
45namespace rtabmap
46{
47
48namespace util3d
49{
50
69void RTABMAP_CORE_EXPORT extractXYZCorrespondences(const std::multimap<int, pcl::PointXYZ> & words1,
70 const std::multimap<int, pcl::PointXYZ> & words2,
71 pcl::PointCloud<pcl::PointXYZ> & cloud1,
72 pcl::PointCloud<pcl::PointXYZ> & cloud2);
73
95void RTABMAP_CORE_EXPORT extractXYZCorrespondencesRANSAC(const std::multimap<int, pcl::PointXYZ> & words1,
96 const std::multimap<int, pcl::PointXYZ> & words2,
97 pcl::PointCloud<pcl::PointXYZ> & cloud1,
98 pcl::PointCloud<pcl::PointXYZ> & cloud2);
99
126void RTABMAP_CORE_EXPORT extractXYZCorrespondences(const std::list<std::pair<cv::Point2f, cv::Point2f> > & correspondences,
127 const cv::Mat & depthImage1,
128 const cv::Mat & depthImage2,
129 float cx, float cy,
130 float fx, float fy,
131 float maxDepth,
132 pcl::PointCloud<pcl::PointXYZ> & cloud1,
133 pcl::PointCloud<pcl::PointXYZ> & cloud2);
134
152void RTABMAP_CORE_EXPORT extractXYZCorrespondences(const std::list<std::pair<cv::Point2f, cv::Point2f> > & correspondences,
153 const pcl::PointCloud<pcl::PointXYZ> & cloud1,
154 const pcl::PointCloud<pcl::PointXYZ> & cloud2,
155 pcl::PointCloud<pcl::PointXYZ> & inliers1,
156 pcl::PointCloud<pcl::PointXYZ> & inliers2);
169void RTABMAP_CORE_EXPORT extractXYZCorrespondences(const std::list<std::pair<cv::Point2f, cv::Point2f> > & correspondences,
170 const pcl::PointCloud<pcl::PointXYZRGB> & cloud1,
171 const pcl::PointCloud<pcl::PointXYZRGB> & cloud2,
172 pcl::PointCloud<pcl::PointXYZ> & inliers1,
173 pcl::PointCloud<pcl::PointXYZ> & inliers2);
174
186int RTABMAP_CORE_EXPORT countUniquePairs(const std::multimap<int, pcl::PointXYZ> & wordsA,
187 const std::multimap<int, pcl::PointXYZ> & wordsB);
188
207void RTABMAP_CORE_EXPORT filterMaxDepth(pcl::PointCloud<pcl::PointXYZ> & inliers1,
208 pcl::PointCloud<pcl::PointXYZ> & inliers2,
209 float maxDepth,
210 char depthAxis,
211 bool removeDuplicates);
212
229void RTABMAP_CORE_EXPORT findCorrespondences(
230 const std::multimap<int, cv::KeyPoint> & wordsA,
231 const std::multimap<int, cv::KeyPoint> & wordsB,
232 std::list<std::pair<cv::Point2f, cv::Point2f> > & pairs);
233
250void RTABMAP_CORE_EXPORT findCorrespondences(
251 const std::multimap<int, cv::Point3f> & words1,
252 const std::multimap<int, cv::Point3f> & words2,
253 std::vector<cv::Point3f> & inliers1,
254 std::vector<cv::Point3f> & inliers2,
255 float maxDepth,
256 std::vector<int> * uniqueCorrespondences = 0);
257
273void RTABMAP_CORE_EXPORT findCorrespondences(
274 const std::map<int, cv::Point3f> & words1,
275 const std::map<int, cv::Point3f> & words2,
276 std::vector<cv::Point3f> & inliers1,
277 std::vector<cv::Point3f> & inliers2,
278 float maxDepth,
279 std::vector<int> * correspondences = 0);
280
281} // namespace util3d
282} // namespace rtabmap
283
284#endif /* UTIL3D_CORRESPONDENCES_H_ */
void RTABMAP_CORE_EXPORT findCorrespondences(const std::multimap< int, cv::KeyPoint > &wordsA, const std::multimap< int, cv::KeyPoint > &wordsB, std::list< std::pair< cv::Point2f, cv::Point2f > > &pairs)
Finds 2D point correspondences between two sets of keypoints based on matching word IDs.
void RTABMAP_CORE_EXPORT extractXYZCorrespondences(const std::multimap< int, pcl::PointXYZ > &words1, const std::multimap< int, pcl::PointXYZ > &words2, pcl::PointCloud< pcl::PointXYZ > &cloud1, pcl::PointCloud< pcl::PointXYZ > &cloud2)
Extracts 3D point correspondences between two sets of labeled 3D points.
void RTABMAP_CORE_EXPORT filterMaxDepth(pcl::PointCloud< pcl::PointXYZ > &inliers1, pcl::PointCloud< pcl::PointXYZ > &inliers2, float maxDepth, char depthAxis, bool removeDuplicates)
Filters pairs of 3D points by maximum depth along a specified axis and optionally removes duplicates.
void RTABMAP_CORE_EXPORT extractXYZCorrespondencesRANSAC(const std::multimap< int, pcl::PointXYZ > &words1, const std::multimap< int, pcl::PointXYZ > &words2, pcl::PointCloud< pcl::PointXYZ > &cloud1, pcl::PointCloud< pcl::PointXYZ > &cloud2)
Extracts reliable 3D point correspondences between two sets of labeled 3D points using RANSAC filteri...
int RTABMAP_CORE_EXPORT countUniquePairs(const std::multimap< int, pcl::PointXYZ > &wordsA, const std::multimap< int, pcl::PointXYZ > &wordsB)
Counts the number of unique 3D point correspondences between two sets of word-indexed features.