├── .gitignore
├── .travis.yml
├── CMakeLists.txt
├── LICENSE
├── README.md
├── doxygen
├── Doxyfile.in
├── DoxygenLayout.xml
├── citations
│ ├── openFABMAP.bib
│ └── openFABMAP.enw
├── images
│ └── surf_small.jpg
└── mainpage.dox.hpp
├── include
├── bowmsctrainer.hpp
├── chowliutree.hpp
├── fabmap.hpp
├── inference.hpp
├── msckd.h
└── openfabmap.hpp
├── samples
├── openFABMAPcli.cpp
└── settings.yml
└── src
├── bowmsctrainer.cpp
├── chowliutree.cpp
├── fabmap.cpp
├── inference.cpp
└── msckd.cpp
/.gitignore:
--------------------------------------------------------------------------------
1 | # OpenFABMAP git ignored files
2 |
3 | # Qt Creator
4 | CMakeLists.txt.user
5 | *.autosave
6 |
7 | # Gedit/emacs
8 | *~
9 |
10 | # Diff orig files (when not configured properly)
11 | *.orig
12 |
13 | # build directory
14 |
15 | build/
16 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: cpp
2 |
3 | dist: focal
4 |
5 | compiler:
6 | - gcc
7 |
8 | before_install:
9 | - sudo apt-get update -qq
10 | install:
11 | - sudo apt-get install -qq cmake build-essential libopencv-dev
12 |
13 | before_script:
14 | - mkdir build
15 | - cd build
16 | - cmake .. -DCMAKE_BUILD_TYPE=DEBUG
17 |
18 | script: make -j 2
19 |
20 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This Cmake file written by Michael Warren,
2 | # Queensland University of Technology, Australia
3 | # https://wiki.qut.edu.au/display/cyphy/Michael+Warren
4 | # Last updated 2014-11-03
5 |
6 | project(openFABMAP)
7 |
8 | cmake_minimum_required(VERSION 3.0)
9 |
10 | ## Cmake setup #################################################################
11 |
12 | # make a lib directory in the build directory
13 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
14 |
15 | # tell cmake that the library goes in the library directory
16 | set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
17 |
18 | # make a binary directory in the build directory
19 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
20 |
21 | # tell cmake that the binaries goes in the binary directory
22 | set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
23 |
24 | # Compiler warning level /W3 (msvc) or -Wall (gcc)
25 | if(MSVC)
26 | # Force to always compile with W4
27 | if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
28 | string(REGEX REPLACE "/W[0-4]" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
29 | else()
30 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
31 | endif()
32 | elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
33 | # Update if necessary
34 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic")
35 | endif()
36 |
37 | if(NOT CMAKE_CONFIGURATION_TYPES)
38 | if(NOT CMAKE_BUILD_TYPE)
39 | message(STATUS "Setting build type to 'Release' as none was specified.")
40 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY VALUE "Release")
41 | endif()
42 | endif()
43 |
44 |
45 | ## Required Packages ###########################################################
46 |
47 | # OpenMP speedups
48 | message(STATUS "")
49 | find_package(OpenMP)
50 | if(OPENMP_FOUND)
51 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
52 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
53 | message("Found OpenMP")
54 | endif(OPENMP_FOUND)
55 |
56 | # Find OpenCV.
57 | # If it's not found, set OpenCV_DIR to the directory with OpenCVConfig.cmake
58 | if(WIN32)
59 | set(OpenCV_PATHS
60 | $ENV{OPENCV_HOME}
61 | $ENV{OPENCV_DIR}/../../
62 | C:/opencv/
63 | C:/OpenCV2.2/
64 | C:/OpenCV2.3/
65 | C:/OpenCV2.4/
66 | )
67 | else() # Linux
68 | set(OpenCV_PATHS
69 | $ENV{OPENCV_HOME}/build
70 | /usr/local/share/OpenCV/
71 | /usr/share/OpenCV
72 | )
73 | endif()
74 | find_package(OpenCV REQUIRED NO_MODULE PATHS ${OpenCV_PATHS})
75 |
76 | message("OpenCV version: ${OpenCV_VERSION}")
77 |
78 | if(OpenCV_VERSION VERSION_LESS "2.4.0")
79 | add_definitions(-DUSENONFREE)
80 | elseif(OpenCV_VERSION VERSION_LESS "3.0.0")
81 | if("${OpenCV_LIBRARIES}" MATCHES opencv_nonfree)
82 | message("Non-free packages found. Using e.g. SIFT/SURF")
83 | add_definitions(-DUSENONFREE)
84 | endif()
85 | else()
86 | if("${OpenCV_LIBRARIES}" MATCHES opencv_xfeatures2d)
87 | message("Non-free packages found. Using e.g. SIFT/SURF")
88 | add_definitions(-DUSENONFREE)
89 | endif()
90 | endif()
91 |
92 |
93 | ## openFABMAP library ##########################################################
94 |
95 | # List sources
96 | aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src OPENFABMAP_FILES)
97 |
98 | # Include the headers
99 | file(GLOB OPENFABMAP_IMPL_INCS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp")
100 | file(GLOB OPENFABMAP_INCS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
101 |
102 | # tell cmake about the library
103 | add_library(openFABMAP ${OPENFABMAP_FILES}
104 | ${OPENFABMAP_IMPL_INCS} ${OPENFABMAP_INCS})
105 |
106 | # Tell CMake where the headers are
107 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${OpenCV_INCLUDE_DIRS})
108 |
109 | # Link against the required libraries in OpenCV >=2.2
110 | target_link_libraries(openFABMAP ${OpenCV_LIBRARIES})
111 |
112 | ## openFABMAPcli executable ####################################################
113 |
114 | # Tell the project where settings / doxygen / readme files are (for Qt Creator)
115 | file(GLOB SETTINGS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/samples/settings.yml")
116 | file(GLOB DOXY_FILES "${CMAKE_CURRENT_SOURCE_DIR}"
117 | ".travis.yml" "doxygen/*.dox" "doxygen/*.dox.*" "doxygen/*.xml")
118 | set(README_FILES "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
119 |
120 | # Copy the settings file across when building (not used for now)
121 | #FILE(COPY ${SETTINGS_FILE} DESTINATION ${CMAKE_BINARY_DIR}/bin)
122 |
123 | # Tell cmake about the binary
124 | add_executable(openFABMAPcli ${CMAKE_SOURCE_DIR}/samples/openFABMAPcli.cpp
125 | ${SETTINGS_FILE} ${DOXY_FILES} ${README_FILES})
126 |
127 | # Tell openFABMAPcli to link against its required libs
128 | target_link_libraries(openFABMAPcli openFABMAP ${OpenCV_LIBRARIES} )
129 |
130 |
131 | ## Doxygen API documentation ###################################################
132 |
133 | # Add the 'doc' target to generate API documentation with Doxygen
134 | set(DOXYGEN_CREATE_DOCS false CACHE BOOL "Create documentation with Doxygen")
135 | if(DOXYGEN_CREATE_DOCS)
136 | find_package(Doxygen)
137 | if(DOXYGEN_FOUND)
138 | # Process and copy configuration file
139 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen/Doxyfile.in
140 | ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
141 | # Uncomment ALL to make every time. Otherwise use "make doc"
142 | add_custom_target(doc #ALL
143 | ${DOXYGEN_EXECUTABLE}
144 | ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
145 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
146 | COMMENT "Generating API documentation with Doxygen" VERBATIM
147 | )
148 | else(DOXYGEN_FOUND)
149 | message(WARNING "Doxygen package not found, no documentation target")
150 | endif(DOXYGEN_FOUND)
151 | endif(DOXYGEN_CREATE_DOCS)
152 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | /*//////////////////////////////////////////////////////////////////////////////
2 | //
3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 | //
5 | // By downloading, copying, installing or using the software you agree to this
6 | // license. If you do not agree to this license, do not download, install,
7 | // copy or use the software.
8 | //
9 | // This file originates from the openFABMAP project:
10 | // [http://code.google.com/p/openfabmap/] -or-
11 | // [https://github.com/arrenglover/openfabmap]
12 | //
13 | // For published work which uses all or part of OpenFABMAP, please cite:
14 | // [http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6224843]
15 | //
16 | // Original Algorithm by Mark Cummins and Paul Newman:
17 | // [http://ijr.sagepub.com/content/27/6/647.short]
18 | // [http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=5613942]
19 | // [http://ijr.sagepub.com/content/30/9/1100.abstract]
20 | //
21 | // License Agreement
22 | //
23 | // Copyright (C) 2012 Arren Glover [aj.glover@qut.edu.au] and
24 | // Will Maddern [w.maddern@qut.edu.au], all rights reserved.
25 | //
26 | //
27 | // Redistribution and use in source and binary forms, with or without
28 | // modification, are permitted provided that the following conditions are met:
29 | //
30 | // * Redistribution's of source code must retain the above copyright notice,
31 | // this list of conditions and the following disclaimer.
32 | //
33 | // * Redistribution's in binary form must reproduce the above copyright notice,
34 | // this list of conditions and the following disclaimer in the documentation
35 | // and/or other materials provided with the distribution.
36 | //
37 | // * The name of the copyright holders may not be used to endorse or promote
38 | // products derived from this software without specific prior written
39 | /// permission.
40 | //
41 | // This software is provided by the copyright holders and contributors "as is"
42 | // and any express or implied warranties, including, but not limited to, the
43 | // implied warranties of merchantability and fitness for a particular purpose
44 | // are disclaimed. In no event shall the Intel Corporation or contributors be
45 | // liable for any direct, indirect, incidental, special, exemplary, or
46 | // consequential damages (including, but not limited to, procurement of
47 | // substitute goods or services; loss of use, data, or profits; or business
48 | // interruption) however caused and on any theory of liability, whether in
49 | // contract, strict liability,or tort (including negligence or otherwise)
50 | // arising in any way out of the use of this software, even if advised of the
51 | // possibility of such damage.
52 | //////////////////////////////////////////////////////////////////////////////*/
53 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # openFABMAP
2 |
3 | Open Source C++ Code for the FAB-MAP Algorithm
4 |
5 | [St. Lucia Multiple Times of Day and Other Datasets](https://github.com/arrenglover/openfabmap/wiki/Datasets)
6 |
7 | See the [Wiki](https://github.com/arrenglover/openfabmap/wiki) for tips!
8 |
9 | ```
10 | @inproceedings{
11 | author = {Glover, A. and Maddern, W. and Warren, M. and Reid, S. and Milford, M. and Wyeth, G.},
12 | title = {OpenFABMAP: An Open Source Toolbox for Appearance-based Loop Closure Detection},
13 | booktitle = {The International Conference on Robotics and Automation},
14 | address = {St Paul, Minnesota},
15 | publisher = {IEEE},
16 | year = {2011}
17 | }
18 | ```
19 |
20 | OpenFABMAP [Glover et. al. 2012](http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=5509547&tag=1) is an open-source, OpenCV-only dependent, version of the popular Fast Appearance-based Mapping (FAB-MAP) algorithm [Cummins & Newman 2008](http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=5509547&tag=1 Glover et al. 2010). OpenFABMAP was developed from the ground-up following FAB-MAP publications. The original FAB-MAP algorithm is now also [open-source](http://www.robots.ox.ac.uk/~mjc/Software.htm) but requires alternative project dependencies.
21 |
22 | FAB-MAP is a Simultaneous Localisation and Mapping algorithm which operates solely in appearance space. FAB-MAP performs location matching between places that have been visited within the world as well as providing a measure of the probability of being at a new, previously unvisited location. Camera images form the sole input to the system, from which OpenCV's feature extraction methods are used to develop bag-of-words representations for the Bayesian comparison technique.
23 |
24 | The code has implementations of
25 | * Feature Detection, Feature Extraction, and Bag-of-words models using OpenCV
26 | * Chow-Liu tree implementation
27 | * FAB-MAP v1.0 [Cummins & Newman 2008](http://ijr.sagepub.com/content/27/6/647.short Cummins & Newman 2008)
28 | * FAB-MAP v1.0 using a Look-up-table for improved computation speed
29 | * FAB-MAP with Fast-Bailout [Cummins & Newman 2010](http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=5613942)
30 | * FAB-MAP v2.0 [Cummins & Newman 2010](http://ijr.sagepub.com/content/30/9/1100.short)
31 |
32 | An overview of OpenFABMAP [Glover et. al. 2012](http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=5509547&tag=1) or the original implementation/use [Glover et al. 2010](http://eprints.qut.edu.au/50317/1/glover_ICRA2012_final.pdf).
33 |
34 | As of the latest version, openFABMAP is dependent solely on [OpenCV 2.3](http://opencv.org/) or higher. The project has a [CMake](http://www.cmake.org/) build environment for general use on both Linux and Windows systems. OpenFABMAP is also designed to integrate with [ROS](http://www.ros.org/wiki/). See the [CyPhy-ROS](https://wiki.qut.edu.au/display/cyphy/cyphy+ROS+wiki+page) page for a package that has implemented openFABMAP as a ROS node.
35 |
36 | The original googlecode project page was [here](http://code.google.com/p/openfabmap/)
37 |
38 |
39 |
40 | ### Installation
41 |
42 | Linux (g++)
43 |
44 | 1. install cmake `sudo apt install cmake`
45 | 1. install opencv `sudo apt install libopencv-dev`
46 | 1. get the openFABMAP code `git clone https://github.com/arrenglover/openfabmap.git`
47 | 1. make the build directory `mkdir openfabmap/build && cd openfabmap/build`
48 | 1. use cmake to compile the makefile `cmake ..`. *note: the output will tell you which version of opencv you are using and if you are using the "non-free" modules*
49 | 1. make the project `make`
50 | 1. view/modify the settings file `gedit ../samples/settings.yml`
51 | 1. run the command line tool `bin/openFABMAPcli -s ../samples/settings.yml`
52 |
53 | OpenCV non-free for OpenCV 3.4
54 |
55 | 1. clone opencv_contrib
56 | 1. clone opencv repository
57 | 1. checkout version 3.4
58 | 1. mkdir build && cd build
59 | 1. cmake .. -DOPENCV_EXTRA_MODULES_PATH='path_to/opencv_contrib/modules' -DBUILD_opencv_xfeatures2d=ON -DOPENCV_ENABLE_NONFREE=ON
60 | 1. make
61 |
62 | Windows (Visual Studio 2008)
63 |
64 | 1. install [openCV2.3](http://opencv.willowgarage.com/wiki/)
65 | 2. install [cmake](www.cmake.org/)
66 | 3. open the cmake gui, specify the source directory (the directory this README is in), a build directory for the code, and click configure
67 | 4. you may have to specify the location of opencv2.3 in UngroupedEntries->OPENCV_PATH.
68 | 5. click configure in the cmake gui again
69 | 6. click generate
70 | 7. open the visual studio solution, for default running right-click on openFABMAPexe project and select 'Set as StartUp project'. Compile openFABMAP within Visual studio.
71 | 8. add required .dll files from openCV2.3 to your build/bin directory (respective debug versions for debug mode).
72 | 9. you also may need an extra tbb .dll due to OpenCV bug which can be downloaded [here](http://threadingbuildingblocks.org/ver.php?fid=171)
73 | 10. under openFABMAPcli->properties->Debugging->command arguments specify the path to the settings file (e.g. "-s samples\settings.yml")
74 | 11. Alter the settings file for your data
75 | 12. run exampleopenFABMAP in your build/bin directory (respective debug versions for debug mode).
76 |
77 | ### Contributors
78 |
79 | - Arren GLover
80 | - Will Maddern
81 | - Kirk MacTavish
82 |
--------------------------------------------------------------------------------
/doxygen/DoxygenLayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
--------------------------------------------------------------------------------
/doxygen/citations/openFABMAP.bib:
--------------------------------------------------------------------------------
1 | @article{
2 | author = {Cummins, Mark and Newman, Paul},
3 | title = {FAB-MAP: Probabilistic Localization and Mapping in the Space of Appearance},
4 | journal = {International Journal of Robotics Research},
5 | volume = {27},
6 | number = {6},
7 | pages = {647-665},
8 | note = {1377517},
9 | year = {2008}
10 | }
11 |
12 | @article{
13 | author = {Cummins, M. and Newman, P.},
14 | title = {Accelerating FAB-MAP with concentration inequalities},
15 | journal = {IEEE Transactions on Robotics},
16 | volume = {26},
17 | number = {6},
18 | pages = {1042-1050},
19 | year = {2010}
20 | }
21 |
22 | @article{
23 | author = {Cummins, M. and Newman, P.},
24 | title = {Appearance-only SLAM at large scale with FAB-MAP 2.0},
25 | journal = {The International Journal of Robotics Research},
26 | year = {2010}
27 | }
28 |
29 | @inproceedings{
30 | author = {Glover, A. and Maddern, W. and Milford, M. and Wyeth, G.},
31 | title = {FAB-MAP+ RatSLAM: Appearance-based SLAM for Multiple Times of Day},
32 | booktitle = {The International Conference on Robotics and Automation},
33 | address = {Anchorage, Alaska, USA},
34 | publisher = {IEEE},
35 | pages = {3507-3512},
36 | year = {2010}
37 | }
38 |
39 | @inproceedings{
40 | author = {Glover, A. and Maddern, W. and Warren, M. and Reid, S. and Milford, M. and Wyeth, G.},
41 | title = {OpenFABMAP: An Open Source Toolbox for Appearance-based Loop Closure Detection},
42 | booktitle = {The International Conference on Robotics and Automation},
43 | address = {St Paul, Minnesota},
44 | publisher = {IEEE},
45 | year = {2011}
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/doxygen/citations/openFABMAP.enw:
--------------------------------------------------------------------------------
1 | %0 Journal Article
2 | %A Cummins, Mark
3 | %A Newman, Paul
4 | %D 2008
5 | %T FAB-MAP: Probabilistic Localization and Mapping in the Space of Appearance
6 | %J International Journal of Robotics Research
7 | %V 27
8 | %N 6
9 | %P 647-665
10 | %! FAB-MAP: Probabilistic Localization and Mapping in the Space of Appearance
11 | %@ 0278-3649
12 | %R http://dx.doi.org/10.1177/0278364908090961
13 | %Z 1377517
14 |
15 |
16 |
17 | %0 Journal Article
18 | %A Cummins, M.
19 | %A Newman, P.
20 | %D 2010
21 | %T Appearance-only SLAM at large scale with FAB-MAP 2.0
22 | %J The International Journal of Robotics Research
23 | %! Appearance-only SLAM at large scale with FAB-MAP 2.0
24 | %@ 0278-3649
25 |
26 |
27 |
28 | %0 Journal Article
29 | %A Cummins, M.
30 | %A Newman, P.
31 | %D 2010
32 | %T Accelerating FAB-MAP with concentration inequalities
33 | %J IEEE Transactions on Robotics
34 | %V 26
35 | %N 6
36 | %P 1042-1050
37 | %! Accelerating FAB-MAP with concentration inequalities
38 | %@ 1552-3098
39 |
40 |
41 |
42 | %0 Conference Proceedings
43 | %A Glover, A.
44 | %A Maddern, W.
45 | %A Milford, M.
46 | %A Wyeth, G.
47 | %D 2010
48 | %T FAB-MAP+ RatSLAM: Appearance-based SLAM for Multiple Times of Day
49 | %B The International Conference on Robotics and Automation
50 | %C Anchorage, Alaska, USA
51 | %I IEEE
52 | %P 3507-3512
53 | %! FAB-MAP+ RatSLAM: Appearance-based SLAM for Multiple Times of Day
54 | %@ 1050-4729
55 |
56 |
57 |
58 | %0 Conference Proceedings
59 | %A Glover, A.
60 | %A Maddern, W.
61 | %A Warren, M.
62 | %A Reid, S.
63 | %A Milford, M.
64 | %A Wyeth, G.
65 | %D 2011
66 | %T OpenFABMAP: An Open Source Toolbox for Appearance-based Loop Closure Detection
67 | %B The International Conference on Robotics and Automation
68 | %C St Paul, Minnesota
69 | %I IEEE
70 | %! OpenFABMAP: An Open Source Toolbox for Appearance-based Loop Closure Detection
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/doxygen/images/surf_small.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arrenglover/openfabmap/47fef64e2cb6407604cbce415a44a9b9e6219da8/doxygen/images/surf_small.jpg
--------------------------------------------------------------------------------
/doxygen/mainpage.dox.hpp:
--------------------------------------------------------------------------------
1 | // Main Page Doxygen Documentation
2 |
3 | ///
4 | /// \file
5 | ///
6 | /// \brief TODO: Move this to README.md and translate to markdown
7 | ///
8 |
9 | namespace cv
10 | {
11 |
12 | namespace of2
13 | {
14 |
15 | /*! \mainpage OpenFABMAP
16 | *
17 | *
18 | * This is an open and modifiable code-source which implements the Fast Appearance-based
19 | * Mapping algorithm (FAB-MAP) originally developed by Mark Cummins and Paul Newman.
20 | * OpenFABMAP was designed from published FAB-MAP theory and is for personal and research
21 | * use.
22 | *
23 | * FAB-MAP is a Simultaneous Localisation and Mapping algorithm which operates in
24 | * appearance space only. FAB-MAP performs location matching between places that have
25 | * been visited within the world as well as providing a measure of the probability of
26 | * being at a new, previously unvisited location. Camera images form the sole input to
27 | * the system, from which bag-of-words models are formed through the extraction of
28 | * appearance-based (e.g. SURF) features.
29 | *
30 | * The code has implementations of
31 | * * Feature Detection and Extraction and Bag-of-words models using OpenCV
32 | * * BOWMSCTrainer, a Bag-of-Words vocabulary trainer
33 | * (Teynor & Burkhardt 2007)
34 | * * ChowLiuTree, a Chow-Liu tree implementation
35 | * (Chow & Liu 1968)
36 | * * FabMap1, the original FabMap algorithm
37 | * (Cummins & Newman 2008)
38 | * * FabMapLUT which uses a look-up table to precompute commonly used calculations for FabMap
39 | * * FabMapFBO which uses the fast bail-out speed-up for FabMap
40 | * (Cummins & Newman 2010)
41 | * * FabMap2 which is able to handle much larger environments than the earlier FabMap algorithms
42 | * (Cummins & Newman 2010)
43 | *
44 | * For an overview of OpenFABMAP see
45 | * (Glover et al. 2012).
46 | * OpenFABMAP was first used in
47 | * (Glover et al. 2010).
48 | *
49 | * As of the latest version, openFABMAP is dependent solely on OpenCV2.3 or
51 | * higher. The project is designed to integrate with OpenCV 2.3 2D feature-based methods
52 | * and storage methods. The project has a CMake build
53 | * environment for general use on both Linux and Windows systems. See the README file for
54 | * more information on compiling the code.
55 | *
56 | * OpenFABMAP is also designed to integrate with Robot
57 | * Operating System (ROS). See the CyPhy-ROS page
59 | * for a package that has implemented openFABMAP as a ROS node.
60 | *
61 | * For questions on how to modify the source to your specific implementation, bug
62 | * reporting, comments and suggestions, or if you would like to become involved in
63 | * developing the openFABMAP project beyond the current implementation, contact via
64 | * github.
65 | *
66 | * Citations Endnote
67 | * Bibtex
68 | *
69 | * \image html surf_small.jpg "SURF features used by FAB-MAP"
70 | *
71 | */
72 |
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/include/bowmsctrainer.hpp:
--------------------------------------------------------------------------------
1 | /*//////////////////////////////////////////////////////////////////////////////
2 | //
3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 | //
5 | // By downloading, copying, installing or using the software you agree to this
6 | // license. If you do not agree to this license, do not download, install,
7 | // copy or use the software.
8 | //
9 | // This file originates from the openFABMAP project:
10 | // [http://code.google.com/p/openfabmap/] -or-
11 | // [https://github.com/arrenglover/openfabmap]
12 | //
13 | // For published work which uses all or part of OpenFABMAP, please cite:
14 | // [http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6224843]
15 | //
16 | // Original Algorithm by Mark Cummins and Paul Newman:
17 | // [http://ijr.sagepub.com/content/27/6/647.short]
18 | // [http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=5613942]
19 | // [http://ijr.sagepub.com/content/30/9/1100.abstract]
20 | //
21 | // License Agreement
22 | //
23 | // Copyright (C) 2012 Arren Glover [aj.glover@qut.edu.au] and
24 | // Will Maddern [w.maddern@qut.edu.au], all rights reserved.
25 | //
26 | //
27 | // Redistribution and use in source and binary forms, with or without
28 | // modification, are permitted provided that the following conditions are met:
29 | //
30 | // * Redistribution's of source code must retain the above copyright notice,
31 | // this list of conditions and the following disclaimer.
32 | //
33 | // * Redistribution's in binary form must reproduce the above copyright notice,
34 | // this list of conditions and the following disclaimer in the documentation
35 | // and/or other materials provided with the distribution.
36 | //
37 | // * The name of the copyright holders may not be used to endorse or promote
38 | // products derived from this software without specific prior written
39 | /// permission.
40 | //
41 | // This software is provided by the copyright holders and contributors "as is"
42 | // and any express or implied warranties, including, but not limited to, the
43 | // implied warranties of merchantability and fitness for a particular purpose
44 | // are disclaimed. In no event shall the Intel Corporation or contributors be
45 | // liable for any direct, indirect, incidental, special, exemplary, or
46 | // consequential damages (including, but not limited to, procurement of
47 | // substitute goods or services; loss of use, data, or profits; or business
48 | // interruption) however caused and on any theory of liability, whether in
49 | // contract, strict liability,or tort (including negligence or otherwise)
50 | // arising in any way out of the use of this software, even if advised of the
51 | // possibility of such damage.
52 | //////////////////////////////////////////////////////////////////////////////*/
53 |
54 | #ifndef BOWMSCTRAINER_H_
55 | #define BOWMSCTRAINER_H_
56 |
57 | #include
58 | #include
59 |
60 |
61 | namespace of2 {
62 |
63 | ///
64 | /// \brief A custom vocabulary training method based on:
65 | /// http://www.springerlink.com/content/d1h6j8x552532003/.
66 | ///
67 | class CV_EXPORTS BOWMSCTrainer: public cv::BOWTrainer {
68 | public:
69 | BOWMSCTrainer(double clusterSize = 0.4);
70 | virtual ~BOWMSCTrainer();
71 |
72 | // Returns trained vocabulary (i.e. cluster centers).
73 | virtual cv::Mat cluster() const;
74 | virtual cv::Mat cluster(const cv::Mat& descriptors) const;
75 |
76 | protected:
77 |
78 | double clusterSize;
79 |
80 | };
81 |
82 | } // namespace of2
83 |
84 | #endif /* BOWMSCTRAINER_H_ */
85 |
--------------------------------------------------------------------------------
/include/chowliutree.hpp:
--------------------------------------------------------------------------------
1 | /*//////////////////////////////////////////////////////////////////////////////
2 | //
3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 | //
5 | // By downloading, copying, installing or using the software you agree to this
6 | // license. If you do not agree to this license, do not download, install,
7 | // copy or use the software.
8 | //
9 | // This file originates from the openFABMAP project:
10 | // [http://code.google.com/p/openfabmap/] -or-
11 | // [https://github.com/arrenglover/openfabmap]
12 | //
13 | // For published work which uses all or part of OpenFABMAP, please cite:
14 | // [http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6224843]
15 | //
16 | // Original Algorithm by Mark Cummins and Paul Newman:
17 | // [http://ijr.sagepub.com/content/27/6/647.short]
18 | // [http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=5613942]
19 | // [http://ijr.sagepub.com/content/30/9/1100.abstract]
20 | //
21 | // License Agreement
22 | //
23 | // Copyright (C) 2012 Arren Glover [aj.glover@qut.edu.au] and
24 | // Will Maddern [w.maddern@qut.edu.au], all rights reserved.
25 | //
26 | //
27 | // Redistribution and use in source and binary forms, with or without
28 | // modification, are permitted provided that the following conditions are met:
29 | //
30 | // * Redistribution's of source code must retain the above copyright notice,
31 | // this list of conditions and the following disclaimer.
32 | //
33 | // * Redistribution's in binary form must reproduce the above copyright notice,
34 | // this list of conditions and the following disclaimer in the documentation
35 | // and/or other materials provided with the distribution.
36 | //
37 | // * The name of the copyright holders may not be used to endorse or promote
38 | // products derived from this software without specific prior written
39 | /// permission.
40 | //
41 | // This software is provided by the copyright holders and contributors "as is"
42 | // and any express or implied warranties, including, but not limited to, the
43 | // implied warranties of merchantability and fitness for a particular purpose
44 | // are disclaimed. In no event shall the Intel Corporation or contributors be
45 | // liable for any direct, indirect, incidental, special, exemplary, or
46 | // consequential damages (including, but not limited to, procurement of
47 | // substitute goods or services; loss of use, data, or profits; or business
48 | // interruption) however caused and on any theory of liability, whether in
49 | // contract, strict liability,or tort (including negligence or otherwise)
50 | // arising in any way out of the use of this software, even if advised of the
51 | // possibility of such damage.
52 | //////////////////////////////////////////////////////////////////////////////*/
53 |
54 | #ifndef CHOWLIUTREE_H_
55 | #define CHOWLIUTREE_H_
56 |
57 | #include
58 |
59 | #include
60 | #include
61 |
62 | namespace of2 {
63 |
64 | ///
65 | /// \brief A Chow-Liu tree implementation designed for FAB-MAP.
66 | ///
67 | /// A Chow-Liu tree is required by FAB-MAP. The Chow-Liu tree provides an
68 | /// estimate of the full distribution of visual words using a minimum spanning
69 | /// tree. The tree is generated from training data.
70 | ///
71 | class CV_EXPORTS ChowLiuTree {
72 | public:
73 | ChowLiuTree();
74 | virtual ~ChowLiuTree();
75 |
76 | //@{
77 | ///
78 | /// \brief You add data to the chow-liu tree before calling make.
79 | /// \param imgDescriptor A \#imgs x \#words bag of words descriptor.
80 | ///
81 | void add(const cv::Mat& imgDescriptor);
82 | ///
83 | /// \brief You add data to the chow-liu tree before calling make.
84 | /// \param imgDescriptors A vector of \#imgs x \#words bag of words descriptors.
85 | ///
86 | void add(const std::vector& imgDescriptors);
87 | //@}
88 |
89 | const std::vector& getImgDescriptors() const;
90 |
91 | ///
92 | /// \brief Builds the Chow Liu tree from the descriptors that have been added.
93 | /// \param infoThreshold Ignores word pairs whose mutual information is below this threshold.
94 | /// \return A Mat containing the 4 x |v| Chow Liu tree,
95 | /// where (0,q) is parent (p) index, (1,q) is P(q), (2,q) is P(q|p), (3,q) is P(q|~p)
96 | ///
97 | cv::Mat make(double infoThreshold = 0.0);
98 |
99 | private:
100 | std::vector imgDescriptors;
101 | cv::Mat mergedImgDescriptors;
102 |
103 | typedef struct info {
104 | float score;
105 | short word1;
106 | short word2;
107 | } info;
108 |
109 | //probabilities extracted from mergedImgDescriptors
110 | double P(int a, bool za);
111 | double JP(int a, bool za, int b, bool zb); //a & b
112 | double CP(int a, bool za, int b, bool zb); // a | b
113 |
114 | //calculating mutual inforMation of all edges
115 | void createBaseEdges(std::list& edges, double infoThreshold);
116 | double calcMutInfo(int word1, int word2);
117 | static bool sortInfoScores(const info& first, const info& second);
118 |
119 | //selecting minimum spanning egdges with maximum inforMation
120 | bool reduceEdgesToMinSpan(std::list& edges);
121 |
122 | //building the tree sctructure
123 | cv::Mat buildTree(int root_word, std::list &edges);
124 | void recAddToTree(cv::Mat &cltree, int q, int pq,
125 | std::list &remaining_edges);
126 | std::vector extractChildren(std::list &remaining_edges, int q);
127 |
128 | };
129 |
130 | } // namespace of2
131 |
132 | #endif /* CHOWLIUTREE_H_ */
133 |
--------------------------------------------------------------------------------
/include/fabmap.hpp:
--------------------------------------------------------------------------------
1 | /*//////////////////////////////////////////////////////////////////////////////
2 | //
3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 | //
5 | // By downloading, copying, installing or using the software you agree to this
6 | // license. If you do not agree to this license, do not download, install,
7 | // copy or use the software.
8 | //
9 | // This file originates from the openFABMAP project:
10 | // [http://code.google.com/p/openfabmap/] -or-
11 | // [https://github.com/arrenglover/openfabmap]
12 | //
13 | // For published work which uses all or part of OpenFABMAP, please cite:
14 | // [http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6224843]
15 | //
16 | // Original Algorithm by Mark Cummins and Paul Newman:
17 | // [http://ijr.sagepub.com/content/27/6/647.short]
18 | // [http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=5613942]
19 | // [http://ijr.sagepub.com/content/30/9/1100.abstract]
20 | //
21 | // License Agreement
22 | //
23 | // Copyright (C) 2012 Arren Glover [aj.glover@qut.edu.au] and
24 | // Will Maddern [w.maddern@qut.edu.au], all rights reserved.
25 | //
26 | //
27 | // Redistribution and use in source and binary forms, with or without
28 | // modification, are permitted provided that the following conditions are met:
29 | //
30 | // * Redistribution's of source code must retain the above copyright notice,
31 | // this list of conditions and the following disclaimer.
32 | //
33 | // * Redistribution's in binary form must reproduce the above copyright notice,
34 | // this list of conditions and the following disclaimer in the documentation
35 | // and/or other materials provided with the distribution.
36 | //
37 | // * The name of the copyright holders may not be used to endorse or promote
38 | // products derived from this software without specific prior written
39 | /// permission.
40 | //
41 | // This software is provided by the copyright holders and contributors "as is"
42 | // and any express or implied warranties, including, but not limited to, the
43 | // implied warranties of merchantability and fitness for a particular purpose
44 | // are disclaimed. In no event shall the Intel Corporation or contributors be
45 | // liable for any direct, indirect, incidental, special, exemplary, or
46 | // consequential damages (including, but not limited to, procurement of
47 | // substitute goods or services; loss of use, data, or profits; or business
48 | // interruption) however caused and on any theory of liability, whether in
49 | // contract, strict liability,or tort (including negligence or otherwise)
50 | // arising in any way out of the use of this software, even if advised of the
51 | // possibility of such damage.
52 | //////////////////////////////////////////////////////////////////////////////*/
53 |
54 | #ifndef FABMAP_H_
55 | #define FABMAP_H_
56 |
57 | #include "inference.hpp"
58 |
59 | #include
60 |
61 | #include
62 | #include
63 | #include