77#include < opencv2/opencv.hpp>
88#include < vector>
99#include < xrslam/version.h>
10- #include < chrono>
11- #include < thread>
1210
1311namespace xrslam {
1412
15- template <int Rows = Eigen::Dynamic, int Cols = Rows, bool UseRowMajor = false , typename T = double >
13+ template <int Rows = Eigen::Dynamic, int Cols = Rows, bool UseRowMajor = false ,
14+ typename T = double >
1615using matrix = typename std::conditional<
1716 Rows != 1 && Cols != 1 ,
18- Eigen::Matrix<T, Rows, Cols, UseRowMajor ? Eigen::RowMajor : Eigen::ColMajor>,
17+ Eigen::Matrix<T, Rows, Cols,
18+ UseRowMajor ? Eigen::RowMajor : Eigen::ColMajor>,
1919 Eigen::Matrix<T, Rows, Cols>>::type;
2020
21- template <int Dimension = Eigen::Dynamic, bool RowVector = false , typename T = double >
21+ template <int Dimension = Eigen::Dynamic, bool RowVector = false ,
22+ typename T = double >
2223using vector =
2324 typename std::conditional<RowVector, matrix<1 , Dimension, false , T>,
2425 matrix<Dimension, 1 , false , T>>::type;
2526
2627using quaternion = Eigen::Quaternion<double >;
2728
28- using matrix6 = matrix<6 , 6 >;
29- using matrix3 = matrix<3 , 3 >;
30- using matrix2 = matrix<2 , 2 >;
31- using matrix1 = matrix<1 , 1 >;
32- using matrix6x3 = matrix<6 , 3 >;
33- using matrix6x1 = matrix<6 , 1 >;
34- using matrixX = matrix<-1 , -1 >;
35-
36- using vector6 = vector<6 >;
37- using vector5 = vector<5 >;
38- using vector4 = vector<4 >;
39- using vector3 = vector<3 >;
40- using vector2 = vector<2 >;
41- using vector1 = vector<1 >;
42- using vectorX = vector<-1 >;
43-
4429struct Pose {
4530 Pose () {
4631 q.setIdentity ();
4732 p.setZero ();
4833 }
4934 quaternion q;
5035 vector<3 > p;
36+
37+ matrix<4 > to_matrix (){
38+ matrix<4 > T;
39+ T.setIdentity ();
40+ T.block <3 , 3 >(0 , 0 ) = q.toRotationMatrix ();
41+ T.block <3 , 1 >(0 , 3 ) = p;
42+ return T;
43+ }
44+
45+ static Pose from_matrix (matrix<4 > T){
46+ Pose pose;
47+ pose.q = quaternion (T.block <3 , 3 >(0 , 0 ));
48+ pose.p = T.block <3 , 1 >(0 , 3 );
49+ return pose;
50+ }
5151};
5252
5353using OutputPose = Pose;
@@ -68,6 +68,7 @@ struct OutputObject {
6868 int isolated;
6969};
7070
71+
7172class Config {
7273 public:
7374 virtual ~Config ();
@@ -131,6 +132,14 @@ class Config {
131132 virtual double parsac_norm_scale () const ;
132133 virtual size_t parsac_keyframe_check_size () const ;
133134
135+ virtual bool backend_flag () const ;
136+ virtual std::string backend_voc_file () const ;
137+ virtual size_t backend_orb_n_features () const ;
138+ virtual double backend_orb_scale_factor () const ;
139+ virtual size_t backend_orb_n_levels () const ;
140+ virtual size_t backend_orb_init_threshold_fast () const ;
141+ virtual size_t backend_orb_min_threshold_fast () const ;
142+
134143 void log_config () const ;
135144};
136145
@@ -189,25 +198,6 @@ class XRSLAM {
189198 std::unique_ptr<Detail> detail;
190199};
191200
192- struct Timer {
193- Timer (){reset ();}
194-
195- void reset (){
196- t1 = std::chrono::duration_cast<std::chrono::duration<double >>(std::chrono::high_resolution_clock::now ().time_since_epoch ()).count ();
197- }
198-
199- double get_time (){
200- double t2 = std::chrono::duration_cast<std::chrono::duration<double >>(std::chrono::high_resolution_clock::now ().time_since_epoch ()).count ();
201- return t2 - t1;
202- }
203-
204- void sleep (double seconds){
205- std::this_thread::sleep_for (std::chrono::milliseconds ((int )(seconds * 1000 )));
206- }
207-
208- double t1;
209- };
210-
211201} // namespace xrslam
212202
213203#endif // XRSLAM_XRSLAM_H
0 commit comments