Skip to content

Commit

Permalink
airslam
Browse files Browse the repository at this point in the history
  • Loading branch information
xukuanHIT committed Aug 8, 2024
1 parent ae81563 commit 890b728
Show file tree
Hide file tree
Showing 186 changed files with 38,149 additions and 6,512 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ weights/*
debug/*
*.so
*/__pycache__/*
voc/*
15 changes: 15 additions & 0 deletions 3rdparty/DBoW2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.idea
cmake-build-debug
datasets
build/*
saving/*
data/*
# *.jpg
# *.png
*.engine
.vscode/*
model/*
weights/*
debug/*
*.so
*/__pycache__/*
33 changes: 33 additions & 0 deletions 3rdparty/DBoW2/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
language: cpp
os:
- linux
- osx
- windows
dist:
- bionic
osx_image:
- xcode11.3
env:
- OPENCV_BRANCH=master
- OPENCV_BRANCH=3.4
cache:
directories:
- ${TRAVIS_BUILD_DIR}/opencv
before_script:
- rmdir opencv || true
- if [ ! -d opencv ]; then git clone --single-branch --branch ${OPENCV_BRANCH} https://github.com/opencv/opencv.git; fi
- pushd opencv
- mkdir -p build
- cd build
- cmake .. -DBUILD_LIST=core,imgproc,imgcodecs,calib3d,highgui -DBUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=../install
- cmake --build . --parallel 8 --target install --config Release
- popd
script:
- mkdir -p build
- cd build
- export OPENCV_CONFIG=$(dirname $(find ${TRAVIS_BUILD_DIR}/opencv/install -name OpenCVConfig.cmake | head -n1))
- cmake .. -DOpenCV_DIR=${OPENCV_CONFIG}
- cmake --build . --config Release
- export DEMO=$(find . -type f \( -name demo.exe -o -name demo \) | head -n1)
- export PATH="$PATH:${TRAVIS_BUILD_DIR}/opencv/install/x86/vc15/bin"
- echo | $DEMO
65 changes: 65 additions & 0 deletions 3rdparty/DBoW2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
cmake_minimum_required(VERSION 3.0)
project(DBoW2)
include(ExternalProject)

option(BUILD_DBoW2 "Build DBoW2" ON)
option(BUILD_Demo "Build demo application" OFF)

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()

if(MSVC)
add_compile_options(/W4)
else()
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

set(HDRS
include/DBoW2/BowVector.h include/DBoW2/FBrief.h
include/DBoW2/QueryResults.h include/DBoW2/TemplatedDatabase.h include/DBoW2/FORB.h
include/DBoW2/DBoW2.h include/DBoW2/FClass.h include/DBoW2/FeatureVector.h
include/DBoW2/ScoringObject.h include/DBoW2/TemplatedVocabulary.h)
set(SRCS
src/BowVector.cpp src/FBrief.cpp src/FORB.cpp
src/FeatureVector.cpp src/QueryResults.cpp src/ScoringObject.cpp)

set(DEPENDENCY_DIR ${CMAKE_CURRENT_BINARY_DIR}/dependencies)
set(DEPENDENCY_INSTALL_DIR ${DEPENDENCY_DIR}/install)

find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})

if(BUILD_DBoW2)
set(LIB_SHARED "SHARED")
if(WIN32)
set(LIB_SHARED "STATIC")
endif(WIN32)
add_library(${PROJECT_NAME} ${LIB_SHARED} ${SRCS})
target_include_directories(${PROJECT_NAME} PUBLIC include/DBoW2/ include/)
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11)
endif(BUILD_DBoW2)

if(BUILD_Demo)
add_executable(demo demo/demo.cpp)
target_link_libraries(demo ${PROJECT_NAME} ${OpenCV_LIBS})
set_target_properties(demo PROPERTIES CXX_STANDARD 11)
file(COPY demo/images DESTINATION ${CMAKE_BINARY_DIR}/)
endif(BUILD_Demo)

configure_file(src/DBoW2.cmake.in
"${PROJECT_BINARY_DIR}/DBoW2Config.cmake" @ONLY)

install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
if(BUILD_DBoW2)
install(DIRECTORY include/DBoW2 DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
endif()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/DBoW2Config.cmake"
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME})
install(FILES "${PROJECT_BINARY_DIR}/DBoW2Config.cmake"
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/DBoW2/)
install(DIRECTORY ${DEPENDENCY_INSTALL_DIR}/ DESTINATION ${CMAKE_INSTALL_PREFIX} OPTIONAL)

46 changes: 46 additions & 0 deletions 3rdparty/DBoW2/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
DBoW2: bag-of-words library for C++ with generic descriptors

Copyright (c) 2015 Dorian Galvez-Lopez. http://doriangalvez.com
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The original author of the work must be notified of any
redistribution of source code or in binary form.
4. Neither the name of copyright holders nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

If you use it in an academic work, please cite:

@ARTICLE{GalvezTRO12,
author={G\'alvez-L\'opez, Dorian and Tard\'os, J. D.},
journal={IEEE Transactions on Robotics},
title={Bags of Binary Words for Fast Place Recognition in Image Sequences},
year={2012},
month={October},
volume={28},
number={5},
pages={1188--1197},
doi={10.1109/TRO.2012.2197158},
ISSN={1552-3098}
}

75 changes: 75 additions & 0 deletions 3rdparty/DBoW2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
DBoW2
=====

DBoW2 is an improved version of the DBow library, an open source C++ library for indexing and converting images into a bag-of-word representation. It implements a hierarchical tree for approximating nearest neighbours in the image feature space and creating a visual vocabulary. DBoW2 also implements an image database with inverted and direct files to index images and enabling quick queries and feature comparisons. The main differences with the previous DBow library are:

* DBoW2 classes are templated, so it can work with any type of descriptor.
* DBoW2 is shipped with classes to directly work with ORB or BRIEF descriptors.
* DBoW2 adds a direct file to the image database to do fast feature comparison. This is used by DLoopDetector.
* DBoW2 does not use a binary format any longer. On the other hand, it uses the OpenCV storage system to save vocabularies and databases. This means that these files can be stored as plain text in YAML format, making compatibility easier, or compressed in gunzip format (.gz) to reduce disk usage.
* Some pieces of code have been rewritten to optimize speed. The interface of DBoW2 has been simplified.
* For performance reasons, DBoW2 does not support stop words.

DBoW2 requires OpenCV and the `Boost::dynamic_bitset` class in order to use the BRIEF version.

DBoW2, along with DLoopDetector, has been tested on several real datasets, yielding an execution time of 3 ms to convert the BRIEF features of an image into a bag-of-words vector and 5 ms to look for image matches in a database with more than 19000 images.

## Citing

If you use this software in an academic work, please cite:

@ARTICLE{GalvezTRO12,
author={G\'alvez-L\'opez, Dorian and Tard\'os, J. D.},
journal={IEEE Transactions on Robotics},
title={Bags of Binary Words for Fast Place Recognition in Image Sequences},
year={2012},
month={October},
volume={28},
number={5},
pages={1188--1197},
doi={10.1109/TRO.2012.2197158},
ISSN={1552-3098}
}
}

## Usage notes

### Weighting and Scoring

DBoW2 implements the same weighting and scoring mechanisms as DBow. Check them here. The only difference is that DBoW2 scales all the scores to [0..1], so that the scaling flag is not used any longer.

### Save & Load

All vocabularies and databases can be saved to and load from disk with the save and load member functions. When a database is saved, the vocabulary it is associated with is also embedded in the file, so that vocabulary and database files are completely independent.

You can also add the vocabulary or database data to any file opened with a `cv::FileStorage` structure.

You can save the vocabulary or the database with any file extension. If you use .gz, the file is automatically compressed (OpenCV behaviour).

## Implementation notes

### Template parameters

DBoW2 has two main classes: `TemplatedVocabulary` and `TemplatedDatabase`. These implement the visual vocabulary to convert images into bag-of-words vectors and the database to index images. These classes are templated:

template<class TDescriptor, class F>
class TemplatedVocabulary
{
...
};

template<class TDescriptor, class F>
class TemplatedDatabase
{
...
};

Two classes must be provided: `TDescriptor` is the data type of a single descriptor vector, and `F`, a class with the functions to manipulate descriptors, derived from `FClass`.

For example, to work with ORB descriptors, `TDescriptor` is defined as `cv::Mat` (of type `CV_8UC1`), which is a single row that contains 32 8-bit values. When features are extracted from an image, a `std::vector<TDescriptor>` must be obtained. In the case of BRIEF, `TDescriptor` is defined as `boost::dynamic_bitset<>`.

The `F` parameter is the name of a class that implements the functions defined in `FClass`. These functions get `TDescriptor` data and compute some result. Classes to deal with ORB and BRIEF descriptors are already included in DBoW2. (`FORB`, `FBrief`).

### Predefined Vocabularies and Databases

To make it easier to use, DBoW2 defines two kinds of vocabularies and databases: `OrbVocabulary`, `OrbDatabase`, `BriefVocabulary`, `BriefDatabase`. Please, check the demo application to see how they are created and used.
Loading

0 comments on commit 890b728

Please sign in to comment.