├── backend
├── CMakeLists.txt
└── include
│ └── ygz
│ └── BackendInterface.h
├── Thirdparty
├── fast
│ ├── test
│ │ ├── data
│ │ │ └── test1.png
│ │ └── test.cpp
│ ├── README.md
│ ├── package.xml
│ ├── fastConfig.cmake.in
│ ├── include
│ │ └── fast
│ │ │ ├── fast.h
│ │ │ └── faster_corner_utilities.h
│ └── CMakeLists.txt
├── g2o
│ ├── README.txt
│ ├── config.h
│ ├── config.h.in
│ ├── g2o
│ │ ├── types
│ │ │ ├── dquat2mat.h
│ │ │ ├── g2o_types_slam3d_api.h
│ │ │ ├── edge_se3_lotsofxyz.h
│ │ │ ├── types_slam3d.h
│ │ │ ├── isometry3d_gradients.cpp
│ │ │ ├── se3_ops.h
│ │ │ ├── CMakeLists.txt
│ │ │ ├── types_sba.cpp
│ │ │ ├── types_sba.h
│ │ │ ├── parameter_stereo_camera.h
│ │ │ ├── dquat2mat.cpp
│ │ │ ├── types_slam3d.cpp
│ │ │ ├── se3_ops.hpp
│ │ │ ├── edge_pointxyz.cpp
│ │ │ ├── edge_se3.h
│ │ │ ├── parameter_stereo_camera.cpp
│ │ │ ├── edge_se3_offset.h
│ │ │ ├── edge_se3_prior.h
│ │ │ ├── edge_se3_pointxyz_depth.h
│ │ │ ├── parameter_camera.h
│ │ │ └── edge_pointxyz.h
│ │ ├── core
│ │ │ ├── parameter.cpp
│ │ │ ├── robust_kernel.cpp
│ │ │ ├── base_vertex.hpp
│ │ │ ├── parameter.h
│ │ │ ├── optimization_algorithm_gauss_newton.h
│ │ │ ├── optimization_algorithm.cpp
│ │ │ ├── optimization_algorithm_property.h
│ │ │ ├── matrix_structure.h
│ │ │ ├── creators.h
│ │ │ ├── solver.cpp
│ │ │ ├── optimization_algorithm_with_hessian.h
│ │ │ ├── parameter_container.h
│ │ │ ├── robust_kernel.h
│ │ │ ├── openmp_mutex.h
│ │ │ ├── matrix_operations.h
│ │ │ ├── jacobian_workspace.h
│ │ │ ├── batch_stats.cpp
│ │ │ ├── jacobian_workspace.cpp
│ │ │ ├── sparse_block_matrix_test.cpp
│ │ │ └── optimization_algorithm_dogleg.h
│ │ └── stuff
│ │ │ ├── os_specific.h
│ │ │ ├── os_specific.c
│ │ │ ├── color_macros.h
│ │ │ └── property.cpp
│ ├── license-bsd.txt
│ └── cmake_modules
│ │ └── FindEigen3.cmake
└── DBoW2
│ ├── DUtils
│ ├── config.h
│ └── Random.cpp
│ ├── README.txt
│ ├── CMakeLists.txt
│ ├── DBoW2
│ ├── FeatureVector.h
│ ├── FClass.h
│ ├── FORB.h
│ ├── FeatureVector.cpp
│ ├── BowVector.h
│ ├── ScoringObject.h
│ └── BowVector.cpp
│ └── LICENSE.txt
├── examples
├── simimu
│ └── matlabscripts
│ │ ├── hat.m
│ │ ├── vee.m
│ │ ├── traj_gen.m
│ │ ├── imu_sensor.m
│ │ ├── t3.m
│ │ ├── plotaxis.m
│ │ └── generateRP.m
├── CMakeLists.txt
├── Kitti.yaml
├── EurocStereo.yaml
├── EuRoC.yaml
├── EurocStereoVIO.yaml
└── EurocStereo.cpp
├── system
├── CMakeLists.txt
├── include
│ └── ygz
│ │ └── System.h
└── src
│ └── System.cpp
├── util
├── CMakeLists.txt
└── include
│ └── ygz
│ └── EurocReader.h
├── install_dep.sh
├── common
├── CMakeLists.txt
├── src
│ └── IMUData.cpp
└── include
│ └── ygz
│ ├── Feature.h
│ ├── IMUData.h
│ ├── Camera.h
│ ├── NumTypes.h
│ └── sophus.hpp
├── cv
├── CMakeLists.txt
└── include
│ └── ygz
│ ├── TrackerLK.h
│ ├── Align.h
│ └── LKFlow.h
├── generate.sh
├── cmake-modules
├── FindCSparse.cmake
├── FindCholmod.cmake
├── FindEigen3.cmake
└── FindG2O.cmake
├── .gitignore
├── LICENSE
└── README.md
/backend/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library( ygz-backend
2 | src/BackendSlidingWindowG2O.cpp
3 | )
--------------------------------------------------------------------------------
/Thirdparty/fast/test/data/test1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gaoxiang12/ygz-stereo-inertial/HEAD/Thirdparty/fast/test/data/test1.png
--------------------------------------------------------------------------------
/examples/simimu/matlabscripts/hat.m:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gaoxiang12/ygz-stereo-inertial/HEAD/examples/simimu/matlabscripts/hat.m
--------------------------------------------------------------------------------
/examples/simimu/matlabscripts/vee.m:
--------------------------------------------------------------------------------
1 | function y = vee( X )
2 | %vee 实现so3的vee
3 |
4 | y = [X(3,2); X(1,3); X(2,1)];
5 |
6 | end
7 |
8 |
--------------------------------------------------------------------------------
/Thirdparty/fast/README.md:
--------------------------------------------------------------------------------
1 | FAST corner detector by Edward Rosten.
2 | The sourcefiles are from the CVD library: http://www.edwardrosten.com/cvd/
3 |
--------------------------------------------------------------------------------
/examples/simimu/matlabscripts/traj_gen.m:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gaoxiang12/ygz-stereo-inertial/HEAD/examples/simimu/matlabscripts/traj_gen.m
--------------------------------------------------------------------------------
/examples/simimu/matlabscripts/imu_sensor.m:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gaoxiang12/ygz-stereo-inertial/HEAD/examples/simimu/matlabscripts/imu_sensor.m
--------------------------------------------------------------------------------
/system/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(ygz-system
2 | src/System.cpp
3 | )
4 |
5 | target_link_libraries( ygz-system
6 | ygz-common ygz-cv ygz-util ygz-backend
7 | )
--------------------------------------------------------------------------------
/util/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library( ygz-util
2 | src/EurocReader.cpp
3 | src/Viewer.cpp
4 | )
5 |
6 | target_link_libraries( ygz-util
7 | ${THIRD_PARTY_LIBS}
8 | )
--------------------------------------------------------------------------------
/install_dep.sh:
--------------------------------------------------------------------------------
1 | sudo apt-get install libopencv-dev libcxsparse3.1.4 libcholmod3.0.6 libsuitesparse-dev libeigen3-dev libqt4-dev qt4-qmake libgoogle-glog-dev libgtest-dev libgflags-dev
2 |
3 |
--------------------------------------------------------------------------------
/examples/simimu/matlabscripts/t3.m:
--------------------------------------------------------------------------------
1 | function y = t3( t )
2 | %t3
3 | % y = [-0.1; -0.6*t; 0.2; 1+2*t; 0; -2];
4 | % y = [-0.1*t; -0.8*t; 0.2; 3+2*t; 0; -2*t*t];
5 | y = [sin(t); sin(t); cos(t); 6*sin(t); sin(t); 3*cos(t)];
6 | end
7 |
--------------------------------------------------------------------------------
/Thirdparty/g2o/README.txt:
--------------------------------------------------------------------------------
1 | You should have received this g2o version along with ORB-SLAM2 (https://github.com/raulmur/ORB_SLAM2).
2 | See the original g2o library at: https://github.com/RainerKuemmerle/g2o
3 | All files included in this g2o version are BSD, see license-bsd.txt
4 |
--------------------------------------------------------------------------------
/common/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(ygz-common
2 | src/IMUData.cpp
3 | src/Settings.cpp
4 | src/Frame.cpp
5 | src/MapPoint.cpp
6 | src/G2OTypes.cpp
7 | )
8 |
9 | target_link_libraries(ygz-common
10 | ${THIRD_PARTY_LIBS}
11 | )
--------------------------------------------------------------------------------
/cv/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(ygz-cv
2 | src/ORBExtractor.cpp
3 | src/ORBMatcher.cpp
4 | src/Tracker.cpp
5 | src/Align.cpp
6 | src/LKFlow.cpp
7 | src/TrackerLK.cpp
8 | )
9 |
10 | target_link_libraries(ygz-cv ygz-common ${THIRD_PARTY_LIBS})
--------------------------------------------------------------------------------
/Thirdparty/DBoW2/DUtils/config.h:
--------------------------------------------------------------------------------
1 | #ifndef CONFIG_H
2 | #define CONFIG_H
3 |
4 | #ifdef WIN32
5 | #ifndef DBoW2_EXPORTS
6 | #define DBoW2_EXPORTS
7 | #endif
8 | #ifdef DBoW2_EXPORTS
9 | #define EXPORT __declspec(dllexport)
10 | #else
11 | #define EXPORT __declspec(dllimport)
12 | #endif
13 | #else
14 | #define EXPORT
15 | #endif
16 |
17 | #endif // CONFIG_H
18 |
--------------------------------------------------------------------------------
/generate.sh:
--------------------------------------------------------------------------------
1 | cd Thirdparty/DBoW2/
2 | mkdir build
3 | cd build
4 | cmake .. -DCMAKE_BUILD_TYPE=Release
5 | make -j4
6 |
7 | cd ../../g2o
8 | mkdir build
9 | cd build
10 | cmake .. -DCMAKE_BUILD_TYPE=Release
11 | make -j4
12 |
13 | cd ../../fast
14 | mkdir build
15 | cd build
16 | cmake .. -DCMAKE_BUILD_TYPE=Release
17 | make -j2
18 |
19 | cd ../../..
20 | mkdir build
21 | cd build
22 | cmake ..
23 | make -j4
24 |
--------------------------------------------------------------------------------
/Thirdparty/DBoW2/README.txt:
--------------------------------------------------------------------------------
1 | You should have received this DBoW2 version along with ORB-SLAM2 (https://github.com/raulmur/ORB_SLAM2).
2 | See the original DBoW2 library at: https://github.com/dorian3d/DBoW2
3 | All files included in this version are BSD, see LICENSE.txt
4 |
5 | We also use Random.h, Random.cpp, Timestamp.pp and Timestamp.h from DLib/DUtils.
6 | See the original DLib library at: https://github.com/dorian3d/DLib
7 | All files included in this version are BSD, see LICENSE.txt
8 |
--------------------------------------------------------------------------------
/Thirdparty/g2o/config.h:
--------------------------------------------------------------------------------
1 | #ifndef G2O_CONFIG_H
2 | #define G2O_CONFIG_H
3 |
4 | /* #undef G2O_OPENMP */
5 | /* #undef G2O_SHARED_LIBS */
6 | /* #undef G2O_OPENGL_FOUND */
7 |
8 | // give a warning if Eigen defaults to row-major matrices.
9 | // We internally assume column-major matrices throughout the code.
10 | #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
11 | # error "g2o requires column major Eigen matrices (see http://eigen.tuxfamily.org/bz/show_bug.cgi?id=422)"
12 | #endif
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/Thirdparty/g2o/config.h.in:
--------------------------------------------------------------------------------
1 | #ifndef G2O_CONFIG_H
2 | #define G2O_CONFIG_H
3 |
4 | #cmakedefine G2O_OPENMP 1
5 | #cmakedefine G2O_SHARED_LIBS 1
6 | #cmakedefine G2O_OPENGL_FOUND 0
7 |
8 | // give a warning if Eigen defaults to row-major matrices.
9 | // We internally assume column-major matrices throughout the code.
10 | #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
11 | # error "g2o requires column major Eigen matrices (see http://eigen.tuxfamily.org/bz/show_bug.cgi?id=422)"
12 | #endif
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/examples/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_executable(EurocStereo EurocStereo.cpp)
2 | target_link_libraries(EurocStereo
3 | ${YGZ_LIBS}
4 | ${THIRD_PARTY_LIBS}
5 | )
6 |
7 | add_executable(EurocStereoVIO EurocStereoVIO.cpp)
8 | target_link_libraries(EurocStereoVIO
9 | ${YGZ_LIBS}
10 | ${THIRD_PARTY_LIBS}
11 | )
12 |
13 | add_executable(Kitti Kitti.cpp)
14 | target_link_libraries(Kitti
15 | ${YGZ_LIBS}
16 | ${THIRD_PARTY_LIBS}
17 | )
18 |
--------------------------------------------------------------------------------
/Thirdparty/fast/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | fast
4 | 1.0.0
5 |
6 | A ROS wrapper for the FAST corner detector by Edward Rosten.
7 | The sourcefiles are from the CVD library: http://www.edwardrosten.com/cvd/
8 |
9 | Christian Forster
10 | LGPL
11 | http://www.edwardrosten.com/work/fast.html
12 | catkin
13 |
--------------------------------------------------------------------------------
/examples/simimu/matlabscripts/plotaxis.m:
--------------------------------------------------------------------------------
1 | function plotaxis(Twi)
2 | % plot frame axis of pose Twi
3 | % Twi: pose
4 | hold on; xlabel('x');ylabel('y');zlabel('z');
5 | Rwi = Twi(1:3,1:3);
6 | twi = Twi(1:3,4);
7 |
8 | oi = twi;
9 | axisx = Rwi*[1;0;0];
10 | plot3([oi(1),oi(1)+axisx(1)],[oi(2),oi(2)+axisx(2)],[oi(3),oi(3)+axisx(3)],'r-');
11 | axisy = Rwi*[0;1;0];
12 | plot3([oi(1),oi(1)+axisy(1)],[oi(2),oi(2)+axisy(2)],[oi(3),oi(3)+axisy(3)],'g-');
13 | axisz = Rwi*[0;0;1];
14 | plot3([oi(1),oi(1)+axisz(1)],[oi(2),oi(2)+axisz(2)],[oi(3),oi(3)+axisz(3)],'b-');
15 |
16 | end
--------------------------------------------------------------------------------
/Thirdparty/fast/fastConfig.cmake.in:
--------------------------------------------------------------------------------
1 | #######################################################
2 | # Fast source dir
3 | set( fast_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
4 |
5 | #######################################################
6 | # Fast build dir
7 | set( fast_DIR "@CMAKE_CURRENT_BINARY_DIR@")
8 |
9 | #######################################################
10 | set( fast_INCLUDE_DIR "@fast_INCLUDE_DIR@" )
11 | set( fast_INCLUDE_DIRS "@fast_INCLUDE_DIR@" )
12 |
13 | set( fast_LIBRARIES "@fast_LIBRARIES@" )
14 | set( fast_LIBRARY "@fast_LIBRARIES@" )
15 |
16 | set( fast_LIBRARY_DIR "@fast_LIBRARY_DIR@" )
17 | set( fast_LIBRARY_DIRS "@fast_LIBRARY_DIR@" )
18 |
--------------------------------------------------------------------------------
/cmake-modules/FindCSparse.cmake:
--------------------------------------------------------------------------------
1 | # Look for csparse; note the difference in the directory specifications!
2 | FIND_PATH(CSPARSE_INCLUDE_DIR NAMES cs.h
3 | PATHS
4 | /usr/include/suitesparse
5 | /usr/include
6 | /opt/local/include
7 | /usr/local/include
8 | /sw/include
9 | /usr/include/ufsparse
10 | /opt/local/include/ufsparse
11 | /usr/local/include/ufsparse
12 | /sw/include/ufsparse
13 | )
14 |
15 | FIND_LIBRARY(CSPARSE_LIBRARY NAMES cxsparse
16 | PATHS
17 | /usr/lib
18 | /usr/local/lib
19 | /opt/local/lib
20 | /sw/lib
21 | )
22 |
23 | include(FindPackageHandleStandardArgs)
24 | find_package_handle_standard_args(CSPARSE DEFAULT_MSG
25 | CSPARSE_INCLUDE_DIR CSPARSE_LIBRARY)
26 |
--------------------------------------------------------------------------------
/Thirdparty/g2o/g2o/types/dquat2mat.h:
--------------------------------------------------------------------------------
1 | #ifndef _DQUAT2MAT_H_
2 | #define _DQUAT2MAT_H_
3 | #include
4 | #include "g2o_types_slam3d_api.h"
5 |
6 | namespace g2o {
7 | namespace internal {
8 |
9 | void G2O_TYPES_SLAM3D_API compute_dq_dR ( Eigen::Matrix& dq_dR , const double& r11 , const double& r21 , const double& r31 , const double& r12 , const double& r22 , const double& r32 , const double& r13 , const double& r23 , const double& r33 );
10 |
11 | void G2O_TYPES_SLAM3D_API compute_dR_dq ( Eigen::Matrix& dR_dq , const double& qx , const double& qy , const double& qz , const double& qw ) ;
12 | }
13 | }
14 | #endif
15 |
--------------------------------------------------------------------------------
/common/src/IMUData.cpp:
--------------------------------------------------------------------------------
1 | #include "ygz/Settings.h"
2 | #include "ygz/IMUData.h"
3 |
4 |
5 | namespace ygz {
6 |
7 | // covariance of measurements
8 | Matrix3d IMUData::mfGyrMeasCov =
9 | Matrix3d::Identity() * setting::gyrMeasError2; // sigma_g * sigma_g / dt, ~6e-6*10
10 | Matrix3d IMUData::mfAccMeasCov = Matrix3d::Identity() * setting::accMeasError2;
11 |
12 | // covariance of bias random walk
13 | Matrix3d IMUData::mfGyrBiasRWCov =
14 | Matrix3d::Identity() * setting::gyrBiasRw2; // sigma_gw * sigma_gw * dt, ~2e-12
15 | Matrix3d IMUData::mfAccBiasRWCov =
16 | Matrix3d::Identity() * setting::accBiasRw2; // sigma_aw * sigma_aw * dt, ~4.5e-8
17 |
18 | }
--------------------------------------------------------------------------------
/examples/Kitti.yaml:
--------------------------------------------------------------------------------
1 | %YAML:1.0
2 | # This is for Kitti 04-12
3 | DatasetDir: /var/dataset/kitti/data_odometry_gray/sequences/08
4 | GroundTruth: /var/dataset/kitti/groundTruthPose/08.txt
5 |
6 | # use vision only
7 | PureVisionMode: true
8 |
9 | # do we need visualization?
10 | UseViewer: true
11 |
12 | # Camera calibration and distortion parameters (OpenCV)
13 | Camera.fx: 707.0912
14 | Camera.fy: 707.0912
15 | Camera.cx: 601.8873
16 | Camera.cy: 183.1104
17 |
18 | Camera.k1: 0.0
19 | Camera.k2: 0.0
20 | Camera.p1: 0.0
21 | Camera.p2: 0.0
22 |
23 | Camera.width: 1241
24 | Camera.height: 376
25 |
26 | # stereo baseline times fx
27 | Camera.bf: 379.8145
28 |
29 | # Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale)
30 | Camera.RGB: 1
31 |
32 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files
2 | *.slo
3 | *.lo
4 | *.o
5 |
6 | # Compiled Dynamic libraries
7 | *.so
8 | *.dylib
9 |
10 | # Compiled Static libraries
11 | *.lai
12 | *.la
13 | *.a
14 |
15 | **.pyc
16 | CMakeCache.txt
17 | CMakeFiles
18 | Makefile
19 | cmake_install.cmake
20 | CMakeLists.txt.user
21 | install_manifest.txt
22 | /doc/html
23 | /doc/latex
24 | index.html
25 |
26 | *build*
27 | bin/*
28 | lib/
29 | results/*
30 | cmake-build-debug/*
31 |
32 | *.kdev4
33 | Examples/Monocular/mono_euroc
34 | Examples/Monocular/mono_kitti
35 | Examples/Monocular/mono_tum
36 | Examples/Monocular/mono_euroc_vins
37 | Examples/RGB-D/rgbd_tum
38 | Examples/Stereo/stereo_euroc
39 | Examples/Stereo/stereo_kitti
40 | KeyFrameTrajectory.txt
41 | Examples/Stereo/stereo_kitti
42 | Examples/Stereo/stereo_euroc
43 | Examples/RGB-D/rgbd_tum
44 | *~
45 | **/KeyFrameTrajectory.txt
46 | **/tmp/
47 | *.bak
48 | callgrind*
49 | log
50 |
51 | .DS*
52 | .idea*
53 |
54 | debug.txt
55 |
--------------------------------------------------------------------------------
/Thirdparty/g2o/g2o/types/g2o_types_slam3d_api.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | * Description: import/export macros for creating DLLS with Microsoft
3 | * compiler. Any exported function needs to be declared with the
4 | * appropriate G2O_XXXX_API macro. Also, there must be separate macros
5 | * for each DLL (arrrrrgh!!!)
6 | *
7 | * 17 Jan 2012
8 | * Email: pupilli@cs.bris.ac.uk
9 | ****************************************************************************/
10 | #ifndef G2O_TYPES_SLAM3D_API_H
11 | #define G2O_TYPES_SLAM3D_API_H
12 |
13 | #include "./config.h"
14 |
15 | #ifdef _MSC_VER
16 | // We are using a Microsoft compiler:
17 | #ifdef G2O_SHARED_LIBS
18 | #ifdef types_slam3d_EXPORTS
19 | #define G2O_TYPES_SLAM3D_API __declspec(dllexport)
20 | #else
21 | #define G2O_TYPES_SLAM3D_API __declspec(dllimport)
22 | #endif
23 | #else
24 | #define G2O_TYPES_SLAM3D_API
25 | #endif
26 |
27 | #else
28 | // Not Microsoft compiler so set empty definition:
29 | #define G2O_TYPES_SLAM3D_API
30 | #endif
31 |
32 | #endif // G2O_TYPES_SLAM3D_API_H
33 |
--------------------------------------------------------------------------------
/Thirdparty/DBoW2/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8)
2 | project(DBoW2)
3 |
4 | # Set optimized building:
5 | if(MSVC_IDE)
6 | add_definitions(-D_CRT_SECURE_NO_WARNINGS)
7 | else(MSVC_IDE)
8 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ")
9 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native")
10 | endif(MSVC_IDE)
11 |
12 | set(HDRS_DBOW2
13 | DBoW2/BowVector.h
14 | DBoW2/FORB.h
15 | DBoW2/FClass.h
16 | DBoW2/FeatureVector.h
17 | DBoW2/ScoringObject.h
18 | DBoW2/TemplatedVocabulary.h)
19 | set(SRCS_DBOW2
20 | DBoW2/BowVector.cpp
21 | DBoW2/FORB.cpp
22 | DBoW2/FeatureVector.cpp
23 | DBoW2/ScoringObject.cpp)
24 |
25 | set(HDRS_DUTILS
26 | DUtils/Random.h
27 | DUtils/Timestamp.h)
28 | set(SRCS_DUTILS
29 | DUtils/Random.cpp
30 | DUtils/Timestamp.cpp)
31 |
32 | find_package(OpenCV REQUIRED)
33 |
34 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
35 |
36 | include_directories(${OpenCV_INCLUDE_DIRS})
37 | add_library(DBoW2 SHARED ${SRCS_DBOW2} ${SRCS_DUTILS})
38 | target_link_libraries(DBoW2 ${OpenCV_LIBS})
39 |
40 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2017 半闲居士
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/util/include/ygz/EurocReader.h:
--------------------------------------------------------------------------------
1 | #ifndef YGZ_EUROC_READER_H
2 | #define YGZ_EUROC_READER_H
3 |
4 | #include "ygz/Settings.h"
5 | #include "ygz/NumTypes.h"
6 | #include "ygz/IMUData.h"
7 |
8 | // 一些用于EuRoC数据集的IO函数
9 |
10 | namespace ygz {
11 |
12 |
13 | // Load the stereo image data
14 | // 输入:左眼图像目录,右眼图像目录,时间戳文件
15 | // 输出:排序后左眼图像文件路径、右眼图像文件路径、时间戳
16 | bool LoadImages(const string &strPathLeft, const string &strPathRight, const string &strPathTimes,
17 | vector &vstrImageLeft, vector &vstrImageRight, vector &vTimeStamps);
18 |
19 | // Load the IMU data
20 | bool LoadImus(const string &strImuPath, VecIMU &vImus);
21 |
22 | /**
23 | * Load the ground truth trajectory
24 | * @param [in] trajPath the path to trajectory, in euroc will be xxx/state_groundtruth_estimate0/data.csv
25 | * @param [out] the loaded trajectory
26 | * @return true if succeed
27 | */
28 | typedef map, Eigen::aligned_allocator> TrajectoryType;
29 |
30 | bool LoadGroundTruthTraj(const string &trajPath,
31 | TrajectoryType &trajectory);
32 | }
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/common/include/ygz/Feature.h:
--------------------------------------------------------------------------------
1 | #ifndef YGZ_FEATURE_H
2 | #define YGZ_FEATURE_H
3 |
4 | #include "ygz/NumTypes.h"
5 | #include "ygz/Settings.h"
6 |
7 | using namespace std;
8 |
9 | namespace ygz {
10 |
11 | // forward declare
12 | struct MapPoint;
13 |
14 | // Feature 是指一个图像点,参数化中有它的invDepth。没有关联地图点时,mpPoint为空
15 | struct Feature {
16 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
17 | Vector2f mPixel = Vector2f(0, 0); // the pixel position
18 | shared_ptr mpPoint = nullptr; // the corresponding map point, nullptr if not associated
19 | float mfInvDepth = -1; // inverse depth, invalid if less than zero.
20 |
21 | // data used in ORB
22 | float mScore = 0; // score, maybe harris or other things
23 | float mAngle = 0; // angle of oriented FAST
24 | size_t mLevel = 0; // the pyramid level
25 | uchar mDesc[32] = {0}; // 256 bits of ORB feature (32x8), ignored if using LK flow
26 |
27 | // flags
28 | bool mbOutlier = false; // true if it is an outlier
29 | };
30 | }
31 |
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/backend/include/ygz/BackendInterface.h:
--------------------------------------------------------------------------------
1 | #ifndef YGZ_BACKEND_H
2 | #define YGZ_BACKEND_H
3 |
4 | #include
5 | #include
6 | #include "ygz/NumTypes.h"
7 |
8 | /**
9 | * 后端的接口,具体函数请在子类实现
10 | * 后端需要做的事:
11 | * 1. 接受前端给出的Key-frame,有单独线程处理Keyframe-Mappoint的优化
12 | * 2. 管理地图点,向前端提供一个较好的局部地图
13 | * 3. 管理关键帧,删除时间久远的帧
14 | */
15 | namespace ygz {
16 |
17 | // forward declare
18 | struct Frame;
19 | struct MapPoint;
20 |
21 | // this is the virtual interface class
22 | class BackendInterface {
23 | public:
24 |
25 | BackendInterface() {}
26 |
27 | virtual ~BackendInterface() {}
28 |
29 | // 插入新关键帧
30 | virtual int InsertKeyFrame(shared_ptr new_kf) =0;
31 |
32 | // 查询后端状态
33 | virtual bool IsBusy() =0;
34 |
35 | // 关闭后端
36 | virtual void Shutdown() =0;
37 |
38 | // 获取局部地图(前端追踪用)
39 | virtual std::set> GetLocalMap() =0;
40 |
41 | // 获取所有的关键帧
42 | virtual std::deque> GetAllKF() =0;
43 |
44 | virtual void Reset() =0;
45 |
46 | virtual void CallLocalBA() =0;
47 |
48 | virtual void OptimizeCurrent(shared_ptr current) =0;
49 |
50 | };
51 |
52 | }
53 |
54 | #endif
--------------------------------------------------------------------------------
/Thirdparty/fast/include/fast/fast.h:
--------------------------------------------------------------------------------
1 | #ifndef FAST_H
2 | #define FAST_H
3 |
4 | #include
5 |
6 | namespace fast
7 | {
8 |
9 | using ::std::vector;
10 |
11 | struct fast_xy
12 | {
13 | short x, y;
14 | fast_xy(short x_, short y_) : x(x_), y(y_) {}
15 | };
16 |
17 | typedef unsigned char fast_byte;
18 |
19 | /// SSE2 optimized version of the corner 10
20 | void fast_corner_detect_10_sse2(const fast_byte* img, int imgWidth, int imgHeight, int widthStep, short barrier, vector& corners);
21 |
22 | /// plain C++ version of the corner 10
23 | void fast_corner_detect_10(const fast_byte* img, int imgWidth, int imgHeight, int widthStep, short barrier, vector& corners);
24 |
25 | /// corner score 10
26 | void fast_corner_score_10(const fast_byte* img, const int img_stride, const vector& corners, const int threshold, vector& scores);
27 |
28 | /// Nonmax Suppression on a 3x3 Window
29 | void fast_nonmax_3x3(const vector& corners, const vector& scores, vector& nonmax_corners);
30 |
31 | /// NEON optimized version of the corner 9
32 | void fast_corner_detect_9_neon(const fast_byte* img, int imgWidth, int imgHeight, int widthStep, short barrier, vector& corners);
33 |
34 | } // namespace fast
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/common/include/ygz/IMUData.h:
--------------------------------------------------------------------------------
1 | #ifndef YGZ_IMUDATA_H_
2 | #define YGZ_IMUDATA_H_
3 |
4 | #include "ygz/NumTypes.h"
5 |
6 | namespace ygz {
7 |
8 | using namespace Eigen;
9 |
10 | struct IMUData {
11 | public:
12 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW
13 |
14 | IMUData(const double &gx, const double &gy, const double &gz,
15 | const double &ax, const double &ay, const double &az,
16 | const double &t) :
17 | mfGyro(gx, gy, gz), mfAcce(ax, ay, az), mfTimeStamp(t) {}
18 |
19 | IMUData(const Vector3d gyro, const Vector3d &acce, const double &time)
20 | : mfGyro(gyro), mfAcce(acce), mfTimeStamp(time) {}
21 |
22 | // Raw data of imu
23 | Vector3d mfGyro; //gyr data
24 | Vector3d mfAcce; //acc data
25 | double mfTimeStamp; //timestamp
26 |
27 | // covariance of measurement
28 | static Matrix3d mfGyrMeasCov; // 陀螺仪的协方差阵,是方差组成的对角阵
29 | static Matrix3d mfAccMeasCov; // 加速度计的协方差阵,是方差组成的对角阵
30 |
31 | // covariance of bias random walk, RW stands for random walk
32 | static Matrix3d mfGyrBiasRWCov; // 随机游走的协方差阵
33 | static Matrix3d mfAccBiasRWCov; // 加速度计随机游走的协方差阵
34 |
35 | };
36 |
37 | typedef std::vector > VecIMU;
38 | }
39 |
40 | #endif // IMUDATA_H
41 |
--------------------------------------------------------------------------------
/Thirdparty/DBoW2/DBoW2/FeatureVector.h:
--------------------------------------------------------------------------------
1 | /**
2 | * File: FeatureVector.h
3 | * Date: November 2011
4 | * Author: Dorian Galvez-Lopez
5 | * Description: feature vector
6 | * License: see the LICENSE.txt file
7 | *
8 | */
9 |
10 | #ifndef __D_T_FEATURE_VECTOR__
11 | #define __D_T_FEATURE_VECTOR__
12 |
13 | #include "BowVector.h"
14 | #include