├── .gitignore
├── .gmmloc_https.install
├── .gmmloc_ssh.install
├── .travis.yml
├── LICENSE
├── README.md
├── gmmloc
├── CMakeLists.txt
├── include
│ └── gmmloc
│ │ ├── common
│ │ ├── common.h
│ │ ├── eigen_stl_types.h
│ │ └── eigen_types.h
│ │ ├── config.h
│ │ ├── cv
│ │ ├── orb_extractor.h
│ │ ├── orb_matcher.h
│ │ ├── orb_vocabulary.h
│ │ └── pinhole_camera.h
│ │ ├── global.h
│ │ ├── gmm
│ │ ├── factors.h
│ │ ├── gaussian.h
│ │ ├── gaussian_mixture.h
│ │ └── gmm_utils.h
│ │ ├── gmmloc.h
│ │ ├── init_config.hpp
│ │ ├── modules
│ │ ├── localization.h
│ │ └── tracking.h
│ │ ├── types
│ │ ├── feature.h
│ │ ├── frame.h
│ │ ├── keyframe.h
│ │ ├── map.h
│ │ └── mappoint.h
│ │ ├── utils
│ │ ├── cv_utils.h
│ │ ├── dataloader.h
│ │ ├── math_utils.h
│ │ ├── nanoflann.hpp
│ │ ├── protobuf_utils.h
│ │ └── timing.h
│ │ └── visualization
│ │ ├── campose_visualizer.h
│ │ ├── gmm_visualizer.h
│ │ └── visualizer.h
├── node
│ └── gmmloc_node.cpp
├── package.xml
├── proto
│ └── gmmloc
│ │ └── GMM.proto
└── src
│ ├── config.cpp
│ ├── cv
│ ├── orb_extractor.cpp
│ ├── orb_matcher.cpp
│ ├── orb_vocabulary.cpp
│ └── pinhole_camera.cpp
│ ├── global.cpp
│ ├── gmm
│ ├── factors.cpp
│ ├── gaussian.cpp
│ ├── gaussian_mixture.cpp
│ └── gmm_utils.cpp
│ ├── gmmloc.cpp
│ ├── gmmloc_opt.cpp
│ ├── modules
│ ├── localization.cpp
│ ├── localization_gmm.cpp
│ ├── localization_opt.cpp
│ ├── tracking.cpp
│ └── tracking_opt.cpp
│ ├── types
│ ├── frame.cpp
│ ├── keyframe.cpp
│ ├── map.cpp
│ └── mappoint.cpp
│ ├── utils
│ ├── cv_utils.cpp
│ ├── dataloader.cpp
│ ├── math_utils.cpp
│ ├── protobuf_utils.cpp
│ └── timing.cpp
│ └── visualization
│ ├── campose_visualizer.cpp
│ ├── gmm_visualizer.cpp
│ └── visualizer.cpp
├── gmmloc_ros
├── CMakeLists.txt
├── cfg
│ ├── euroc_rect.yaml
│ ├── v1.yaml
│ ├── v2.yaml
│ └── viz.rviz
├── data
│ ├── gt
│ │ ├── V1_01_easy.csv
│ │ ├── V1_02_medium.csv
│ │ ├── V1_03_difficult.csv
│ │ ├── V2_01_easy.csv
│ │ ├── V2_02_medium.csv
│ │ └── V2_03_difficult.csv
│ ├── gt_sync
│ │ ├── V1_01_easy.txt
│ │ ├── V1_02_medium.txt
│ │ ├── V1_03_difficult.txt
│ │ ├── V2_01_easy.txt
│ │ ├── V2_02_medium.txt
│ │ └── V2_03_difficult.txt
│ └── map
│ │ ├── v1.gmm
│ │ └── v2.gmm
├── launch
│ ├── v1.launch
│ ├── v2.launch
│ └── viz.launch
├── package.xml
├── scripts
│ ├── evaluate_euroc.sh
│ └── evo_euroc.py
└── voc
│ └── ORBvoc.bin
└── orb_dbow2
├── CMakeLists.txt
├── LICENSE.txt
├── README.txt
├── include
└── orb_dbow2
│ ├── dbow2
│ ├── BowVector.h
│ ├── FClass.h
│ ├── FORB.h
│ ├── FeatureVector.h
│ ├── ScoringObject.h
│ └── TemplatedVocabulary.h
│ └── dutils
│ ├── Random.h
│ ├── Timestamp.h
│ └── config.h
├── package.xml
└── src
├── dbow2
├── BowVector.cpp
├── FORB.cpp
├── FeatureVector.cpp
└── ScoringObject.cpp
└── dutils
├── Random.cpp
└── Timestamp.cpp
/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode
2 | gmmloc_ros/expr/*
3 | todo
4 |
5 | # Prerequisites
6 | *.d
7 |
8 | # Compiled Object files
9 | *.slo
10 | *.lo
11 | *.o
12 | *.obj
13 |
14 | # Precompiled Headers
15 | *.gch
16 | *.pch
17 |
18 | # Compiled Dynamic libraries
19 | *.so
20 | *.dylib
21 | *.dll
22 |
23 | # Fortran module files
24 | *.mod
25 | *.smod
26 |
27 | # Compiled Static libraries
28 | *.lai
29 | *.la
30 | *.a
31 | *.lib
32 |
33 | # Executables
34 | *.exe
35 | *.out
36 | *.app
37 |
--------------------------------------------------------------------------------
/.gmmloc_https.install:
--------------------------------------------------------------------------------
1 | - git:
2 | local-name: deps/catkin_simple
3 | uri: https://github.com/catkin/catkin_simple.git
4 | - git:
5 | local-name: deps/eigen_catkin
6 | uri: https://github.com/ethz-asl/eigen_catkin.git
7 | - git:
8 | local-name: deps/gflags_catkin
9 | uri: https://github.com/ethz-asl/gflags_catkin.git
10 | - git:
11 | local-name: deps/glog_catkin
12 | uri: https://github.com/ethz-asl/glog_catkin.git
13 | - git:
14 | local-name: deps/protobuf_catkin
15 | uri: https://github.com/ethz-asl/protobuf_catkin.git
16 | - git:
17 | local-name: deps/g2o_catkin
18 | uri: https://github.com/hyhuang1995/g2o_catkin.git
19 |
--------------------------------------------------------------------------------
/.gmmloc_ssh.install:
--------------------------------------------------------------------------------
1 | - git:
2 | local-name: deps/catkin_simple
3 | uri: git@github.com:catkin/catkin_simple.git
4 | - git:
5 | local-name: deps/eigen_catkin
6 | uri: git@github.com:ethz-asl/eigen_catkin.git
7 | - git:
8 | local-name: deps/gflags_catkin
9 | uri: git@github.com:ethz-asl/gflags_catkin.git
10 | - git:
11 | local-name: deps/glog_catkin
12 | uri: git@github.com:ethz-asl/glog_catkin.git
13 | - git:
14 | local-name: deps/protobuf_catkin
15 | uri: git@github.com:ethz-asl/protobuf_catkin.git
16 | - git:
17 | local-name: deps/g2o_catkin
18 | uri: git@github.com:hyhuang1995/g2o_catkin.git
19 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | dist: bionic
2 | sudo: required
3 | cache:
4 | - apt
5 | env:
6 | global:
7 | - ROS_CI_DESKTOP="bionic"
8 | - ROS_DISTRO="melodic"
9 | - CI_SOURCE_PATH=$(pwd)
10 |
11 | before_install:
12 | - sudo sh -c "echo \"deb http://packages.ros.org/ros/ubuntu $ROS_CI_DESKTOP main\" > /etc/apt/sources.list.d/ros-latest.list"
13 | - sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
14 | - sudo apt-get update
15 | - sudo apt-get install dpkg
16 | - sudo apt-get install -y libeigen3-dev libqglviewer-dev-qt5 libopencv-dev libsuitesparse-dev
17 | - sudo apt-get install -y python-catkin-pkg python-rosdep python-wstool
18 | - sudo apt-get install python-wstool python-catkin-tools ros-$ROS_DISTRO-desktop ros-melodic-cmake-modules
19 | - source /opt/ros/$ROS_DISTRO/setup.bash
20 |
21 | install:
22 | - mkdir -p ~/catkin_ws/src
23 | - cd ~/catkin_ws/
24 |
25 | # init catkin
26 | - catkin init
27 | - catkin config --extend /opt/ros/melodic
28 | - catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release
29 | - catkin config --merge-devel
30 |
31 | # create symbolic
32 | - cd src
33 | - ln -s $CI_SOURCE_PATH ./gmmloc
34 | # install deps
35 | - wstool init . ./gmmloc/.gmmloc_https.install
36 | - wstool update
37 |
38 | before_script:
39 | - echo $(pwd)
40 | script:
41 | - catkin build gmmloc_ros
42 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # GMMLoc
2 |
3 | [](https://travis-ci.org/github/HyHuang1995/gmmloc)
4 | [-informational)](https://github.com/HyHuang1995/gmmloc/blob/master/LICENSE)
5 |
6 | Dense Map Based Visual Localization. [[project]](https://sites.google.com/view/gmmloc/)
7 |
8 | ## Paper and Video
9 |
10 | Related publication:
11 | ```latex
12 | @article{huang2020gmmloc,
13 | title={GMMLoc: Structure Consistent Visual Localization with Gaussian Mixture Models},
14 | author={Huang, Huaiyang and Ye, Haoyang and Sun, Yuxiang and Liu, Ming},
15 | journal={IEEE Robotics and Automation Letters},
16 | volume={5},
17 | number={4},
18 | pages={5043--5050},
19 | year={2020},
20 | publisher={IEEE}
21 | }
22 | ```
23 |
24 | Demo videos:
25 |
26 |
27 |
29 |
30 | ## Prerequisites
31 |
32 | We have tested this library in Ubuntu 18.04. Prerequisites for installation:
33 |
34 | 1. [ROS](http://wiki.ros.org/melodic/Installation) (melodic)
35 |
36 | 2. [OpenCV3](https://docs.opencv.org/3.4.11/d7/d9f/tutorial_linux_install.html)
37 | ```
38 | apt-get install libopencv-dev
39 | ```
40 | 3. miscs:
41 | ```
42 | apt-get install python-wstool python-catkin-tools
43 | ```
44 | 4. [evo](https://github.com/MichaelGrupp/evo) (optional)
45 | ```
46 | pip install evo --upgrade --no-binary evo
47 | ```
48 |
49 | ## Installation
50 | Initialize a workspace:
51 |
52 | ```
53 | mkdir -p /EXAMPLE/CATKIN/WORK_SPACE
54 | cd /EXAMPLE/CATKIN/WORK_SPACE
55 |
56 | mkdir src
57 | catkin init
58 | catkin config --extend /opt/ros/melodic
59 | catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release
60 | catkin config --merge-devel
61 | ```
62 |
63 | Clone the code:
64 | ```
65 | cd src
66 | git clone git@github.com:hyhuang1995/gmmloc.git
67 | ```
68 |
69 | If using SSH keys for github, prepare the dependencies via:
70 | ```
71 | wstool init . ./gmmloc/gmmloc_ssh.rosinstall
72 | wstool update
73 | ```
74 |
75 | or using https instead:
76 | ```
77 | wstool init . ./gmmloc/gmmloc_https.rosinstall
78 | wstool update
79 | ```
80 |
81 | Compile with:
82 | ```
83 | catkin build gmmloc_ros
84 | ```
85 |
86 | ## Running Examples
87 | We provide examples on EuRoC Vicon Room sequences. For example, to run the demo on V1_03_difficult:
88 |
89 | 1. Download the [sequence](https://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets) (ASL Format)
90 |
91 | 2. Replace the [**/PATH/TO/EUROC/DATASET/**](https://github.com/HyHuang1995/gmmloc/blob/770eadc99229eff17f2f613e969e4e9c10499496/gmmloc_ros/launch/v1.launch#L25) in [v1.launch](https://github.com/HyHuang1995/gmmloc/blob/master/gmmloc_ros/launch/v1.launch) with where the sequence is decompressed:
92 | ```
93 |
94 | ```
95 |
96 | 3. Launch:
97 | ```
98 | roslaunch v1.launch seq:=V1_03_difficult
99 | ```
100 |
101 | ## Evaluation
102 | If evo is installed, we provide script for evaluating on Vicon Room sequences.
103 | ```
104 | roscd gmmloc_ros
105 | ./scripts/evaluate_euroc.sh
106 | ```
107 | and the results would be saved to **gmmloc_ros/expr**.
108 | By default, we follow the evaluation protocol of [DSO](https://vision.in.tum.de/research/vslam/dso) to perform evaluation without multi-threading. If you would like to run the script in online mode, uncomment [this line](https://github.com/HyHuang1995/gmmloc/blob/770eadc99229eff17f2f613e969e4e9c10499496/gmmloc_ros/scripts/evaluate_euroc.sh#L60) in the script:
109 | ```
110 | rosparam set /gmmloc/online True
111 | ```
112 |
113 | ## Credits
114 |
115 | Our implementation is built on top of [ORB-SLAM2](https://github.com/raulmur/ORB_SLAM2), we thank Raul et al. for their great work.
116 |
--------------------------------------------------------------------------------
/gmmloc/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.4)
2 | project(gmmloc)
3 |
4 | find_package(catkin_simple REQUIRED)
5 | catkin_simple()
6 |
7 | add_definitions("${CMAKE_CXX_FLAGS} -Wall -msse3 -std=c++17 -O3 -march=native -Wno-deprecated-declarations")
8 |
9 | set(PROTO_DEFNS proto/gmmloc/GMM.proto)
10 | set(PROTO_LIBRARIES "")
11 | find_package(protobuf_catkin QUIET)
12 | if (protobuf_catkin_FOUND)
13 | message(STATUS "Using protobuf_catkin")
14 | PROTOBUF_CATKIN_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${PROTO_DEFNS})
15 | set(PROTO_LIBRARIES ${protobuf_catkin_LIBRARIES})
16 | else()
17 | message(STATUS "Using system protobuf")
18 | find_package(Protobuf REQUIRED)
19 | PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${PROTO_DEFNS})
20 | set(PROTO_LIBRARIES ${PROTOBUF_LIBRARIES})
21 | endif()
22 |
23 | find_package(OpenCV 3.0 REQUIRED)
24 | # find_package(fmt)
25 | # find_package(PCL REQUIRED COMPONENTS io)
26 |
27 | include_directories(
28 | ${PROJECT_SOURCE_DIR}/include
29 | )
30 |
31 | cs_add_library(${PROJECT_NAME}_proto
32 | ${PROTO_SRCS}
33 | )
34 | set_target_properties(${PROJECT_NAME}_proto PROPERTIES PUBLIC_HEADER "${PROTO_HDRS}")
35 | target_include_directories(${PROJECT_NAME}_proto
36 | PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
37 | target_link_libraries(${PROJECT_NAME}_proto ${PROTO_LIBRARIES})
38 |
39 | cs_add_library(${PROJECT_NAME} SHARED
40 |
41 | src/gmmloc.cpp
42 | src/gmmloc_opt.cpp
43 |
44 | src/global.cpp
45 | src/config.cpp
46 |
47 | src/modules/tracking.cpp
48 | src/modules/tracking_opt.cpp
49 | src/modules/localization.cpp
50 | src/modules/localization_opt.cpp
51 |
52 | src/gmm/factors.cpp
53 | src/gmm/gaussian.cpp
54 | src/gmm/gaussian_mixture.cpp
55 | src/gmm/gmm_utils.cpp
56 |
57 | src/cv/orb_extractor.cpp
58 | src/cv/orb_vocabulary.cpp
59 | src/cv/orb_matcher.cpp
60 | src/cv/pinhole_camera.cpp
61 |
62 | src/types/frame.cpp
63 | src/types/keyframe.cpp
64 | src/types/map.cpp
65 | src/types/mappoint.cpp
66 |
67 | src/utils/dataloader.cpp
68 | src/utils/protobuf_utils.cpp
69 | src/utils/timing.cpp
70 | src/utils/math_utils.cpp
71 | src/utils/cv_utils.cpp
72 |
73 | src/visualization/campose_visualizer.cpp
74 | src/visualization/gmm_visualizer.cpp
75 | src/visualization/visualizer.cpp
76 | )
77 |
78 | target_link_libraries(${PROJECT_NAME}
79 | ${OpenCV_LIBS}
80 | ${PROJECT_NAME}_proto
81 | )
82 |
83 | cs_add_executable(gmmloc_node node/gmmloc_node.cpp)
84 | target_link_libraries(gmmloc_node ${PROJECT_NAME})
85 |
86 | install(TARGETS ${PROJECT_NAME}_proto
87 | LIBRARY DESTINATION "lib"
88 | PUBLIC_HEADER DESTINATION "include"
89 | )
90 | cs_install()
91 | cs_export(
92 | DEPENDS OpenCV
93 | )
94 |
--------------------------------------------------------------------------------
/gmmloc/include/gmmloc/common/common.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include