RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
GainCompensator.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 CORELIB_SRC_GAINCOMPENSATOR_H_
29#define CORELIB_SRC_GAINCOMPENSATOR_H_
30
31#include "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines
32
33#include <pcl/point_cloud.h>
34#include <pcl/point_types.h>
35#include <pcl/pcl_base.h>
36#include <opencv2/opencv.hpp>
37#include <rtabmap/core/Link.h>
38
39namespace rtabmap {
40
44class RTABMAP_CORE_EXPORT GainCompensator {
45public:
46 GainCompensator(double maxCorrespondenceDistance = 0.02, double minOverlap = 0.0, double alpha = 0.01, double beta = 10);
47 virtual ~GainCompensator();
48
49 void feed(
50 const pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloudA, // should not contain NaNs
51 const pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloudB, // should not contain NaNs
52 const Transform & transformB);
53 void feed(
54 const pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloudA,
55 const pcl::IndicesPtr & indicesA,
56 const pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloudB,
57 const pcl::IndicesPtr & indicesB,
58 const Transform & transformB);
59 void feed(
60 const std::map<int, pcl::PointCloud<pcl::PointXYZRGB>::Ptr> & clouds, // should not contain NaNs
61 const std::multimap<int, Link> & links);
62 void feed(
63 const std::map<int, pcl::PointCloud<pcl::PointXYZRGB>::Ptr> & clouds,
64 const std::map<int, pcl::IndicesPtr> & indices,
65 const std::multimap<int, Link> & links);
66 void feed(
67 const std::map<int, pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr> & clouds,
68 const std::map<int, pcl::IndicesPtr> & indices,
69 const std::multimap<int, Link> & links);
70 void feed(
71 const std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr, pcl::IndicesPtr> > & clouds,
72 const std::multimap<int, Link> & links);
73
74 void apply(
75 int id,
76 pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloud,
77 bool rgb = true) const;
78 void apply(
79 int id,
80 pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloud,
81 const pcl::IndicesPtr & indices,
82 bool rgb = true) const;
83 void apply(
84 int id,
85 pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr & cloud,
86 const pcl::IndicesPtr & indices,
87 bool rgb = true) const;
88 void apply(
89 int id,
90 cv::Mat & image,
91 bool rgb = true) const;
92
93 double getGain(int id, double * r=0, double * g=0, double * b=0) const;
94 int getIndex(int id) const;
95
96private:
97 cv::Mat_<double> gains_;
98 std::map<int, int> idToIndex_;
99 double maxCorrespondenceDistance_;
100 double minOverlap_;
101 double alpha_;
102 double beta_;
103
104};
105
106} /* namespace rtabmap */
107
108#endif /* CORELIB_SRC_GAINCOMPENSATOR_H_ */
Represents a 3D rigid body transformation (rotation + translation).
Definition Transform.h:53