slam_calibrator.cpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2013, Alex Teichman and Stephen Miller (Stanford University)
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, 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 <organization> 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 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON 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
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 
27 RTAB-Map integration: Mathieu Labbe
28 */
29 
33 
34 using namespace std;
35 using namespace Eigen;
36 
37 namespace clams
38 {
39 
41  const std::map<int, rtabmap::SensorData> & sequence,
42  const std::map<int, rtabmap::Transform> & trajectory,
43  const pcl::PointCloud<pcl::PointXYZ>::Ptr & map,
44  double coneRadius,
45  double coneStdevThresh)
46 {
48 
49  if(!sequence.empty())
50  {
51  const cv::Size & imageSize = sequence.begin()->second.cameraModels()[0].imageSize();
52  model = DiscreteDepthDistortionModel(imageSize.width, imageSize.height);
53 
54  // -- For all selected frames, accumulate training examples
55  // in the distortion model.
56  size_t counts = 0;
57  //#pragma omp parallel for // error on linux
58  for(std::map<int, rtabmap::Transform>::const_iterator iter = trajectory.begin(); iter != trajectory.end(); ++iter)
59  {
60  size_t idx = iter->first;
61  std::map<int, rtabmap::SensorData>::const_iterator ster = sequence.find(idx);
62  if(ster!=sequence.end())
63  {
64  cv::Mat depthImage;
65  ster->second.uncompressDataConst(0, &depthImage);
66 
67  cv::Mat mapDepth;
68  FrameProjector projector(ster->second.cameraModels()[0]);
69  mapDepth = projector.estimateMapDepth(map, iter->second.inverse(), depthImage, coneRadius, coneStdevThresh);
70  counts = model.accumulate(mapDepth, depthImage);
71  }
72  }
73  UINFO("counts=%d", (int)counts);
74  }
75  return model;
76 }
77 
78 } // namespace clams
cv::Mat estimateMapDepth(const pcl::PointCloud< pcl::PointXYZ >::Ptr &map, const rtabmap::Transform &transform, const cv::Mat &measurement, double coneRadius=0.02, double coneStdevThresh=0.03) const
DiscreteDepthDistortionModel RTABMAP_EXP calibrate(const std::map< int, rtabmap::SensorData > &sequence, const std::map< int, rtabmap::Transform > &trajectory, const pcl::PointCloud< pcl::PointXYZ >::Ptr &map, double coneRadius=0.02, double coneStdevThresh=0.03)
size_t accumulate(const cv::Mat &ground_truth, const cv::Mat &measurement)
ULogger class and convenient macros.
#define UINFO(...)


rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Dec 14 2020 03:35:00