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_MATCHER_H_ 00018 #define SVO_MATCHER_H_ 00019 00020 #include <svo/global.h> 00021 00022 namespace vk { 00023 class AbstractCamera; 00024 namespace patch_score { 00025 template<int HALF_PATCH_SIZE> class ZMSSD; 00026 } 00027 } 00028 00029 namespace svo { 00030 00031 class Point; 00032 class Frame; 00033 class Feature; 00034 00036 namespace warp { 00037 00038 void getWarpMatrixAffine( 00039 const vk::AbstractCamera& cam_ref, 00040 const vk::AbstractCamera& cam_cur, 00041 const Vector2d& px_ref, 00042 const Vector3d& f_ref, 00043 const double depth_ref, 00044 const SE3& T_cur_ref, 00045 const int level_ref, 00046 Matrix2d& A_cur_ref); 00047 00048 int getBestSearchLevel( 00049 const Matrix2d& A_cur_ref, 00050 const int max_level); 00051 00052 void warpAffine( 00053 const Matrix2d& A_cur_ref, 00054 const cv::Mat& img_ref, 00055 const Vector2d& px_ref, 00056 const int level_ref, 00057 const int level_cur, 00058 const int halfpatch_size, 00059 uint8_t* patch); 00060 00061 } // namespace warp 00062 00064 class Matcher 00065 { 00066 public: 00067 static const int halfpatch_size_ = 4; 00068 static const int patch_size_ = 8; 00069 00070 typedef vk::patch_score::ZMSSD<halfpatch_size_> PatchScore; 00071 00072 struct Options 00073 { 00074 bool align_1d; 00075 int align_max_iter; 00076 double max_epi_length_optim; 00077 size_t max_epi_search_steps; 00078 bool subpix_refinement; 00079 bool epi_search_edgelet_filtering; 00080 double epi_search_edgelet_max_angle; 00081 Options() : 00082 align_1d(false), 00083 align_max_iter(10), 00084 max_epi_length_optim(2.0), 00085 max_epi_search_steps(1000), 00086 subpix_refinement(true), 00087 epi_search_edgelet_filtering(true), 00088 epi_search_edgelet_max_angle(0.7) 00089 {} 00090 } options_; 00091 00092 uint8_t* patch_; 00093 uint8_t* patch_with_border_; 00094 Matrix2d A_cur_ref_; 00095 Vector2d epi_dir_; 00096 double epi_length_; 00097 double h_inv_; 00098 int search_level_; 00099 bool reject_; 00100 Feature* ref_ftr_; 00101 Vector2d px_cur_; 00102 00103 Matcher(); 00104 ~Matcher(); 00105 00108 bool findMatchDirect( 00109 const Point& pt, 00110 const Frame& frame, 00111 Vector2d& px_cur); 00112 00114 bool findEpipolarMatchDirect( 00115 const Frame& ref_frame, 00116 const Frame& cur_frame, 00117 const Feature& ref_ftr, 00118 const double d_estimate, 00119 const double d_min, 00120 const double d_max, 00121 double& depth); 00122 00123 void createPatchFromPatchWithBorder(); 00124 }; 00125 00126 } // namespace svo 00127 00128 #endif // SVO_MATCHER_H_