FrameHandlerMono member functions are now virtual to allow specialization

This commit is contained in:
Christian Forster
2014-04-30 12:41:01 +02:00
parent 44f87b860b
commit 8291a6b9c1
2 changed files with 19 additions and 9 deletions
+10 -6
View File
@@ -29,7 +29,7 @@ class FrameHandlerMono : public FrameHandlerBase
{ {
public: public:
FrameHandlerMono(vk::AbstractCamera* cam); FrameHandlerMono(vk::AbstractCamera* cam);
~FrameHandlerMono(); virtual ~FrameHandlerMono();
/// Provide an image. /// Provide an image.
void addImage(const cv::Mat& img, double timestamp); void addImage(const cv::Mat& img, double timestamp);
@@ -60,21 +60,25 @@ protected:
initialization::KltHomographyInit klt_homography_init_; //!< Used to estimate pose of the first two keyframes by estimating a homography. initialization::KltHomographyInit klt_homography_init_; //!< Used to estimate pose of the first two keyframes by estimating a homography.
DepthFilter* depth_filter_; //!< Depth estimation algorithm runs in a parallel thread and is used to initialize new 3D points. DepthFilter* depth_filter_; //!< Depth estimation algorithm runs in a parallel thread and is used to initialize new 3D points.
/// Initialize the visual odometry algorithm.
virtual void initialize();
/// Processes the first frame and sets it as a keyframe. /// Processes the first frame and sets it as a keyframe.
UpdateResult processFirstFrame(); virtual UpdateResult processFirstFrame();
/// Processes all frames after the first frame until a keyframe is selected. /// Processes all frames after the first frame until a keyframe is selected.
UpdateResult processSecondFrame(); virtual UpdateResult processSecondFrame();
/// Processes all frames after the first two keyframes. /// Processes all frames after the first two keyframes.
UpdateResult processFrame(); virtual UpdateResult processFrame();
/// Reset the frame handler. Implement in derived class. /// Reset the frame handler. Implement in derived class.
virtual void resetAll(); virtual void resetAll();
void setCoreKfs(size_t n_closest); /// Keyframe selection criterion.
virtual bool needNewKf(double scene_depth_mean);
bool needNewKf(double scene_depth_mean); void setCoreKfs(size_t n_closest);
}; };
} // namespace svo } // namespace svo
+9 -3
View File
@@ -36,10 +36,16 @@ FrameHandlerMono::FrameHandlerMono(vk::AbstractCamera* cam) :
reprojector_(cam_, map_), reprojector_(cam_, map_),
depth_filter_(NULL) depth_filter_(NULL)
{ {
// create depth filter and set callback initialize();
}
void FrameHandlerMono::initialize()
{
feature_detection::DetectorPtr feature_detector( feature_detection::DetectorPtr feature_detector(
new feature_detection::FastDetector(cam_->width(), cam_->height(), Config::gridSize(), Config::nPyrLevels())); new feature_detection::FastDetector(
DepthFilter::callback_t depth_filter_cb = boost::bind(&MapPointCandidates::newCandidatePoint, &map_.point_candidates_, _1, _2); cam_->width(), cam_->height(), Config::gridSize(), Config::nPyrLevels()));
DepthFilter::callback_t depth_filter_cb = boost::bind(
&MapPointCandidates::newCandidatePoint, &map_.point_candidates_, _1, _2);
depth_filter_ = new DepthFilter(feature_detector, depth_filter_cb); depth_filter_ = new DepthFilter(feature_detector, depth_filter_cb);
depth_filter_->startThread(); depth_filter_->startThread();
} }