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 
00031 
00032 
00033 
00034 
00035 #ifndef VSLAM_SYSTEM_VO_H
00036 #define VSLAM_SYSTEM_VO_H
00037 
00038 
00039 
00040 
00041 
00042 
00043 #ifndef EIGEN_USE_NEW_STDVECTOR
00044 #define EIGEN_USE_NEW_STDVECTOR
00045 #endif // EIGEN_USE_NEW_STDVECTOR
00046 
00047 #include <posest/pe3d.h>
00048 #include <posest/pe2d.h>
00049 #include <sba/sba.h>
00050 #include <frame_common/frame.h>
00051 #include <cstdio>
00052 
00053 namespace fc  = frame_common;
00054 
00055 namespace vslam
00056 {
00060   class voSt
00061   {
00062   public:
00070     voSt(boost::shared_ptr<pe::PoseEstimator> pose_estimator, int ws=20, int wf=5, int mininls=800, double mind=0.1, double mina=0.1);
00071 
00073     sba::SysSBA sba;
00074     
00076     vector<int> ipts;
00077 
00078     int wsize; 
00079     int wfixed; 
00080 
00081     
00082     double mindist; 
00083     double minang;  
00084     int    mininls; 
00085 
00089     bool addFrame(const fc::Frame &fnew); 
00090 
00092     void removeFrame();
00093 
00097     void transferLatestFrame(std::vector<fc::Frame, Eigen::aligned_allocator<fc::Frame> > &eframes,
00098                              sba::SysSBA &esba);
00099 
00106     int findTransform(int frameId, int n, Vector4d &trans, Quaterniond &qrot, Matrix<double,6,6> &prec);
00107 
00109     int findNode(int frameId);
00110 
00112     std::vector<fc::Frame, Eigen::aligned_allocator<fc::Frame> > frames;
00113 
00115     boost::shared_ptr<pe::PoseEstimator> pose_estimator_;
00116     
00118     boost::shared_ptr<frame_common::PointcloudProc> pointcloud_proc_;
00119     bool doPointPlane;
00120     
00121     EIGEN_MAKE_ALIGNED_OPERATOR_NEW 
00122   
00123   private:
00125     std::vector<cv::DMatch> pointcloud_matches_;
00126   };
00127 
00142   void addProjections(fc::Frame &f0, fc::Frame &f1, 
00143                       std::vector<fc::Frame, Eigen::aligned_allocator<fc::Frame> > &frames,
00144                       sba::SysSBA &sba, const std::vector<cv::DMatch> &inliers,
00145                       const Matrix<double,3,4>& f2w, int ndi0, int ndi1, std::vector<int>* ipts = NULL);
00146   
00161   void addPointCloudProjections(fc::Frame &f0, fc::Frame &f1, 
00162                   sba::SysSBA &sba, const std::vector<cv::DMatch> &inliers,
00163                     const Matrix<double,3,4>& f2w_frame0, 
00164                     const Matrix<double,3,4>& f2w_frame1, 
00165                     int ndi0, int ndi1, std::vector<int>* ipts = NULL);
00166   
00168   void substPointRef(std::vector<int> &ipts, int tri0, int tri1);
00169   
00171   Vector3d getProjection(fc::Frame &frame, int index);
00172 } 
00173 
00174 #endif