svo
Semi-Direct Visual Odometry
|
00001 // This file is part of SVO - Semi-direct Visual Odometry. 00002 // 00003 // Copyright (C) 2014 Christian Forster <forster at ifi dot uzh dot ch> 00004 // (Robotics and Perception Group, University of Zurich, Switzerland). 00005 // 00006 // SVO is free software: you can redistribute it and/or modify it under the 00007 // terms of the GNU General Public License as published by the Free Software 00008 // Foundation, either version 3 of the License, or any later version. 00009 // 00010 // SVO is distributed in the hope that it will be useful, but WITHOUT ANY 00011 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 00017 #ifndef SVO_FRAME_HANDLER_H_ 00018 #define SVO_FRAME_HANDLER_H_ 00019 00020 #include <vikit/abstract_camera.h> 00021 #include <svo/frame_handler_base.h> 00022 #include <svo/reprojector.h> 00023 #include <svo/initialization.h> 00024 00025 namespace svo { 00026 00028 class FrameHandlerMono : public FrameHandlerBase 00029 { 00030 public: 00031 FrameHandlerMono(vk::AbstractCamera* cam); 00032 virtual ~FrameHandlerMono(); 00033 00035 void addImage(const cv::Mat& img, double timestamp); 00036 00038 void setFirstFrame(const FramePtr& first_frame); 00039 00041 FramePtr lastFrame() { return last_frame_; } 00042 00044 const set<FramePtr>& coreKeyframes() { return core_kfs_; } 00045 00047 const vector<cv::Point2f>& initFeatureTrackRefPx() const { return klt_homography_init_.px_ref_; } 00048 const vector<cv::Point2f>& initFeatureTrackCurPx() const { return klt_homography_init_.px_cur_; } 00049 00051 DepthFilter* depthFilter() const { return depth_filter_; } 00052 00054 bool relocalizeFrameAtPose( 00055 const int keyframe_id, 00056 const SE3& T_kf_f, 00057 const cv::Mat& img, 00058 const double timestamp); 00059 00060 protected: 00061 vk::AbstractCamera* cam_; 00062 Reprojector reprojector_; 00063 FramePtr new_frame_; 00064 FramePtr last_frame_; 00065 set<FramePtr> core_kfs_; 00066 vector< pair<FramePtr,size_t> > overlap_kfs_; 00067 initialization::KltHomographyInit klt_homography_init_; 00068 DepthFilter* depth_filter_; 00069 00071 virtual void initialize(); 00072 00074 virtual UpdateResult processFirstFrame(); 00075 00077 virtual UpdateResult processSecondFrame(); 00078 00080 virtual UpdateResult processFrame(); 00081 00083 virtual UpdateResult relocalizeFrame( 00084 const SE3& T_cur_ref, 00085 FramePtr ref_keyframe); 00086 00088 virtual void resetAll(); 00089 00091 virtual bool needNewKf(double scene_depth_mean); 00092 00093 void setCoreKfs(size_t n_closest); 00094 }; 00095 00096 } // namespace svo 00097 00098 #endif // SVO_FRAME_HANDLER_H_