Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sift #3

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
7b91b8e
First commit of SIFT version
thierrymalon Apr 16, 2015
5c5e910
Adding FSift.h and FSift.cpp
thierrymalon Apr 16, 2015
fabdfd4
[cmake] added findDLib and update cmakelist and include header
simogasp Apr 16, 2015
a2d1991
[cmake] added gitignore
simogasp Apr 16, 2015
d7954b9
[cmake] updated documentation
simogasp Apr 16, 2015
d18e763
[cmake] minor fix doc
simogasp Apr 16, 2015
364872a
[cmake] compilation fix
simogasp Apr 16, 2015
54d02b5
[sift] restored original demo and renamed sift
simogasp Apr 16, 2015
e090ccb
[sift] added demo in cmake and compilation fix
simogasp Apr 16, 2015
7cdf186
Modifications on demoSift.cpp.
thierrymalon Apr 17, 2015
12efee9
Add of 3 parameters :
thierrymalon Apr 17, 2015
2bb1400
[sift] fixes for command line
simogasp Apr 17, 2015
1592052
[sift] added boost required in cmake (not everybody has it installed …
simogasp Apr 18, 2015
ffbac41
[sift] removed opencv3 support, too many things to change
simogasp Apr 18, 2015
6d76c69
[sift] fix
simogasp Apr 20, 2015
fdbfdee
[sift] minor
simogasp Apr 20, 2015
ff91a22
Directories containing images can now contain any type of documents,
thierrymalon Apr 20, 2015
6204e34
Adding the printing of image retrieval time.
thierrymalon Apr 20, 2015
96101b6
[cmake] compilation fix
simogasp Apr 21, 2015
31378bc
Added descriptor files in the output directory. They are created if they
thierrymalon Apr 22, 2015
d8cd78c
Merge branch 'sift' of https://github.com/thierrymalon/DBoW2 into sift
thierrymalon Apr 22, 2015
e973298
[cmake] harmonized variable names
simogasp Apr 28, 2015
cc94bf6
Merge branch 'sift' of https://github.com/thierrymalon/DBoW2 into sift
simogasp Apr 28, 2015
bdc8a81
Fixes Issue #1
thierrymalon May 6, 2015
5866380
Fixes Issue #1
thierrymalon May 8, 2015
9e0b7fe
Fixes Issue #2
thierrymalon May 8, 2015
7acf79f
added flag to parametrize number of returned images from query
simogasp May 19, 2015
90b3282
Merge branch 'sift' of https://github.com/thierrymalon/DBoW2 into sift
simogasp May 19, 2015
b5102f6
fix after merge conflict
simogasp May 19, 2015
eb7218c
Replacing BinaryFile as they produce .desc files not compatible with
thierrymalon May 21, 2015
b7132a3
Merge branch 'sift' of https://github.com/thierrymalon/DBoW2 into sift
thierrymalon May 21, 2015
bd8cde8
Replacing BinaryFile with popart's functions to write and read .desc
thierrymalon May 21, 2015
8c7ae38
Fix after merge conflict.
thierrymalon May 21, 2015
447d335
When there is no images in the dataset directory, the program now looks
thierrymalon May 21, 2015
f0f5103
Fixes Issue #3
thierrymalon May 22, 2015
28002d9
Saving the vocabulary before testing it.
thierrymalon May 22, 2015
196e166
Adding an option to skip the matching test after voc creation.
thierrymalon May 22, 2015
648acd5
Issue #4
thierrymalon May 26, 2015
31fe4c8
Issue #4
thierrymalon May 27, 2015
5baceda
Iterators are replaced with index to make parallelization possible.
thierrymalon Jun 2, 2015
96988d5
Parallelization of TemplatedVocabulary.h initialization.
thierrymalon Jun 2, 2015
4148444
Parallelization of setNodeWeights in TemplatedVocabulary.h
thierrymalon Jun 3, 2015
45a50cd
Harmonization of the indentation and minor modifications
thierrymalon Jun 3, 2015
e1ac42e
Parallelization of transform in TemplatedVocabulary.h
thierrymalon Jun 4, 2015
ac2cca4
Closed Issue #5
thierrymalon Jun 4, 2015
f185aa2
Adding timers and a waiting option in demoSift.cpp
thierrymalon Jun 4, 2015
9b24bc1
Closed Issue #6
thierrymalon Jun 7, 2015
bec37da
More verbosed version of TemplatedVocabulary
thierrymalon Jun 8, 2015
688ca18
Closes Issue #5
thierrymalon Jun 10, 2015
e34157c
Adding a parameter to specify the db name and load it if exists
thierrymalon Jun 12, 2015
098489f
The database is now saved only if it does not exist yet.
thierrymalon Jun 12, 2015
62d882c
Fixed database saving
thierrymalon Jun 22, 2015
5653aeb
[cmake] added missing cmake function
simogasp Jun 23, 2015
eb3a3b1
Added .feat files creation
thierrymalon Jul 7, 2015
c968e1c
The output specified now contains a directory containing the .desc and
thierrymalon Jul 7, 2015
72213bc
Added a list.txt file to the output to specify in which order the images
thierrymalon Jul 17, 2015
a5c1606
Add images names in the db file
thierrymalon Jul 24, 2015
7b8ea61
Added db loading with file names
thierrymalon Jul 27, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
83 changes: 83 additions & 0 deletions .cmake/FindDLib.cmake
@@ -0,0 +1,83 @@
#.rst:
# FindDLib
# --------
#
# Find the native DLib includes and libraries.
#
# DLib is a collection of C++ classes to solve common tasks in C++ programs, as well as to
# offer additional functionality to use OpenCV data and to solve computer vision problems.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module will set the following variables in your project::
#
# DLIB_FOUND - True if DLib found on the local system
# DLIB_INCLUDE_DIRS - Location of DLib header files.
# DLIB_LIBRARIES - The DLib libraries.
#
# Hints
# ^^^^^
#
# Set ``DLIB_ROOT_DIR`` to a directory that contains a DLib installation.
#
# This script expects to find libraries at ``$DLIB_ROOT_DIR/`` and the DLib
# headers at ``$DLIB_ROOT_DIR``.

# =============================================================================
# Copyright (c) 2015, Simone Gasparini <simone.gasparini@gmail.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. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDER 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.
# =============================================================================

FIND_PATH(DLIB_INCLUDE_DIRS
NAMES ./DUtils/DUtils.h
HINTS
${DLIB_ROOT_DIR}/include
PATHS
/usr/include
/usr/local/include
/sw/include
/opt/local/include
DOC "The directory where DLib headers reside")

message(STATUS "DLIB_INCLUDE_DIRS = ${DLIB_INCLUDE_DIRS}")


FIND_LIBRARY(DLIB_LIBRARIES
NAMES DLib
PATHS ${DLIB_ROOT_DIR}/lib
DOC "The DLib library")

message(STATUS "DLIB_LIBRARIES = ${DLIB_LIBRARIES}")


include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBDLIB_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args( libDLIB DEFAULT_MSG
DLIB_LIBRARIES DLIB_INCLUDE_DIRS )

43 changes: 43 additions & 0 deletions .cmake/UpdateCacheVariable.cmake
@@ -0,0 +1,43 @@
# Ceres Solver - A fast non-linear least squares minimizer
# Copyright 2014 Google Inc. All rights reserved.
# http://code.google.com/p/ceres-solver/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * 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.
# * Neither the name of Google Inc. 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 THE COPYRIGHT OWNER 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.
#
# Author: alexs.mac@gmail.com (Alex Stewart)

# By default, there is no easy way in CMake to set the value of a cache
# variable without reinitialising it, which involves resetting its
# associated help string. This is particularly annoying for CMake options
# where they need to programmatically updated.
#
# This function automates this process by getting the current help string
# for the cache variable to update, then reinitialising it with the new
# value, but with the original help string.
FUNCTION(UPDATE_CACHE_VARIABLE VAR_NAME VALUE)
GET_PROPERTY(HELP_STRING CACHE ${VAR_NAME} PROPERTY HELPSTRING)
GET_PROPERTY(VAR_TYPE CACHE ${VAR_NAME} PROPERTY TYPE)
SET(${VAR_NAME} ${VALUE} CACHE ${VAR_TYPE} "${HELP_STRING}" FORCE)
ENDFUNCTION()
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
build
54 changes: 54 additions & 0 deletions BUILD.md
@@ -0,0 +1,54 @@
DBoW2
=====

----------------------
Building instructions
----------------------

Required tools:
* CMake to build the code
* git
* C/C++ compiler (gcc >= 4.6 or visual studio or clang)


### Dependencies

DBoW2 depends on

- DLib (https://github.com/dorian3d/DLib)
- OpenCV
- Boost::dynamic_bitset


On a recent Ubuntu-like distribution (eg 14.04), you may want to try to run::

$ sudo apt-get install libboost-dev


### Building the dependencies


#### OpenCV 2.4.9
Create a `build` directory where to build the library. It also advisable to set an non-system install directory, so that it will be easier to set up the environment later:
```bash
mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=`pwd`/install
make install -j n
```
where `n` is the number of threads to use for the compilation.



#### DLib
You can refer to the original documentation [here](https://github.com/dorian3d/DLib).

In short you can just run
```bash
mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=`pwd`/install -DOpenCV_DIR=<your path to install/share/OpenCV/ dir of opencv>
make install -j n
```

### Building:

```bash
$ mkdir build && cd build && cmake .. -DOpenCV_DIR=<your path to install/share/OpenCV/ dir of opencv> -DDLIB_ROOT_DIR=<the path you installed DLib>
```
54 changes: 36 additions & 18 deletions CMakeLists.txt
@@ -1,41 +1,59 @@
cmake_minimum_required(VERSION 2.8)
project(DBoW2)

option(WITH_OPENMP "Enable OpenMP multithreading" ON)
option(BUILD_DBoW2 "Build DBoW2" ON)
option(BUILD_Demo "Build demo application" ON)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/.cmake")
include(UpdateCacheVariable)

set(HDRS
include/DBoW2/BowVector.h include/DBoW2/FBrief.h include/DBoW2/FSurf64.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/FSurf64.cpp src/FORB.cpp
src/FeatureVector.cpp src/QueryResults.cpp src/ScoringObject.cpp)
include/DBoW2/BowVector.h include/DBoW2/FBrief.h include/DBoW2/FSurf64.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 include/DBoW2/FSift.h)
set(SRCS
src/BowVector.cpp src/FBrief.cpp src/FSurf64.cpp src/FORB.cpp
src/FeatureVector.cpp src/QueryResults.cpp src/ScoringObject.cpp src/FSift.cpp)

if (WITH_OPENMP)
find_package(OpenMP QUIET)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
else()
message("")
UPDATE_CACHE_VARIABLE(WITH_OPENMP OFF)
endif(OPENMP_FOUND)
endif(WITH_OPENMP)

find_package(OpenCV REQUIRED)
find_package(DLib REQUIRED)
find_package(Boost REQUIRED)

if(BUILD_DBoW2)
include_directories(include/DBoW2/ ${OpenCV_INCLUDE_DIRS} ${DLib_INCLUDE_DIRS})
add_library(${PROJECT_NAME} SHARED ${SRCS})
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS} ${DLib_LIBS})
include_directories(include/DBoW2/ ${OpenCV_INCLUDE_DIRS} ${DLIB_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
add_library(${PROJECT_NAME} SHARED ${SRCS})
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS} ${DLIB_LIBRARIES})
endif(BUILD_DBoW2)

if(BUILD_Demo)
add_executable(demo demo/demo.cpp)
target_link_libraries(demo ${PROJECT_NAME} ${OpenCV_LIBS} ${DLib_LIBS})
file(COPY demo/images DESTINATION ${CMAKE_BINARY_DIR}/)
add_executable(demo demo/demo.cpp)
target_link_libraries(demo ${PROJECT_NAME} ${OpenCV_LIBS} ${DLIB_LIBRARIES})
add_executable(demoSift demo/demoSift.cpp)
target_link_libraries(demoSift ${PROJECT_NAME} ${OpenCV_LIBS} ${DLIB_LIBRARIES})
file(COPY demo/images DESTINATION ${CMAKE_BINARY_DIR}/)
endif(BUILD_Demo)

configure_file(src/DBoW2.cmake.in
"${PROJECT_BINARY_DIR}/DBoW2Config.cmake" @ONLY)
"${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)
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/)
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME})
install(FILES "${PROJECT_BINARY_DIR}/DBoW2Config.cmake"
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/DBoW2/)
6 changes: 2 additions & 4 deletions README.md
Expand Up @@ -32,11 +32,9 @@ If you use this software in an academic work, please cite:
}
}

## Installation notes
## Building

DBoW2 requires OpenCV and the `Boost::dynamic_bitset` class in order to use the BRIEF version. You can install Boost by typing:

$ sudo apt-get install libboost-dev
Check dependencies and compilation instruction in the [BUILD](BUILD.md) file.


## Usage notes
Expand Down
6 changes: 3 additions & 3 deletions demo/demo.cpp
Expand Up @@ -12,9 +12,9 @@
// DBoW2
#include "DBoW2.h" // defines Surf64Vocabulary and Surf64Database

#include "DUtils.h"
#include "DUtilsCV.h" // defines macros CVXX
#include "DVision.h"
#include "DUtils/DUtils.h"
#include "DUtilsCV/DUtilsCV.h" // defines macros CVXX
#include "DVision/DVision.h"

// OpenCV
#include <opencv/cv.h>
Expand Down