class FrameHandlerMono : public FrameHandlerBase

时间:2023-03-09 20:23:49
class FrameHandlerMono : public FrameHandlerBase

单目视觉里程计流程图

class FrameHandlerMono : public FrameHandlerBase

FrameHandlerMono::FrameHandlerMono(vk::AbstractCamera* cam) :
FrameHandlerBase(),
cam_(cam),
reprojector_(cam_, map_),
depth_filter_(NULL)
{
initialize();
}

构造函数,进进行初始化

void FrameHandlerMono::initialize()
初始化函数

主要功能

构建点和线段特征的特征提取器

  // create a point feature detector instance
feature_detection::DetectorPtr<PointFeat> pt_feature_detector;
if(Config::hasPoints())
pt_feature_detector = feature_detection::DetectorPtr<PointFeat>(
new feature_detection::FastDetector(
cam_->width(), cam_->height(), Config::gridSize(), Config::nPyrLevels()));
else
// create an abstract (void) detector that detects nothing to deactivate use of points
pt_feature_detector = feature_detection::DetectorPtr<PointFeat>(
new feature_detection::AbstractDetector<PointFeat>(
cam_->width(), cam_->height(), Config::gridSize(), Config::nPyrLevels()));
  // create a segment feature detector instance
feature_detection::DetectorPtr<LineFeat> seg_feature_detector;
if(Config::hasLines())
seg_feature_detector = feature_detection::DetectorPtr<LineFeat>(
new feature_detection::LsdDetector(
cam_->width(), cam_->height(), Config::gridSizeSegs(), Config::nPyrLevelsSegs()));
else
// create an abstract (void) detector that detects nothing to deactivate use of line segs
seg_feature_detector = feature_detection::DetectorPtr<LineFeat>(
new feature_detection::AbstractDetector<LineFeat>(
cam_->width(), cam_->height(), Config::gridSizeSegs(), Config::nPyrLevelsSegs()));

创建点和线段特征的深度滤波器

  // create the callback object for the Depth-Filter
DepthFilter::callback_t depth_filter_cb = boost::bind(
&MapPointCandidates::newCandidatePoint, &map_.point_candidates_, _1, _2); DepthFilter::callback_t_ls depth_filter_cb_ls = boost::bind(
&MapSegmentCandidates::newCandidateSegment, &map_.segment_candidates_, _1, _2, _3); // Setup the Depth-Filter object
depth_filter_ = new DepthFilter(pt_feature_detector, seg_feature_detector, depth_filter_cb, depth_filter_cb_ls );
depth_filter_->startThread();
}

vo_->start();
启动函数,设置

  /// Start processing.
void start() { set_start_ = true; }