Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "rtabmap/core/clams/slam_calibrator.h"
00031 #include "rtabmap/core/clams/frame_projector.h"
00032 #include <rtabmap/utilite/ULogger.h>
00033
00034 using namespace std;
00035 using namespace Eigen;
00036
00037 namespace clams
00038 {
00039
00040 DiscreteDepthDistortionModel calibrate(
00041 const std::map<int, rtabmap::SensorData> & sequence,
00042 const std::map<int, rtabmap::Transform> & trajectory,
00043 const pcl::PointCloud<pcl::PointXYZ>::Ptr & map,
00044 double coneRadius,
00045 double coneStdevThresh)
00046 {
00047 DiscreteDepthDistortionModel model;
00048
00049 if(!sequence.empty())
00050 {
00051 const cv::Size & imageSize = sequence.begin()->second.cameraModels()[0].imageSize();
00052 model = DiscreteDepthDistortionModel(imageSize.width, imageSize.height);
00053
00054
00055
00056 size_t counts = 0;
00057
00058 for(std::map<int, rtabmap::Transform>::const_iterator iter = trajectory.begin(); iter != trajectory.end(); ++iter)
00059 {
00060 size_t idx = iter->first;
00061 std::map<int, rtabmap::SensorData>::const_iterator ster = sequence.find(idx);
00062 if(ster!=sequence.end())
00063 {
00064 cv::Mat depthImage;
00065 ster->second.uncompressDataConst(0, &depthImage);
00066
00067 cv::Mat mapDepth;
00068 FrameProjector projector(ster->second.cameraModels()[0]);
00069 mapDepth = projector.estimateMapDepth(map, iter->second.inverse(), depthImage, coneRadius, coneStdevThresh);
00070 counts = model.accumulate(mapDepth, depthImage);
00071 }
00072 }
00073 UINFO("counts=%d", (int)counts);
00074 }
00075 return model;
00076 }
00077
00078 }