Skip to content

Commit

Permalink
Initial commit of Windows version
Browse files Browse the repository at this point in the history
  • Loading branch information
ducha-aiki committed May 24, 2016
0 parents commit 41cfadc
Show file tree
Hide file tree
Showing 646 changed files with 171,629 additions and 0 deletions.
145 changes: 145 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
cmake_minimum_required(VERSION 2.8)

PROJECT(MODS)

add_definitions(-DA64)
add_definitions(-std=c++11)

SET(WITH_CAFFE FALSE)

message("Looking for OpenCV")
SET (OpenCV_DIR "C:/opencv-2.4.8/opencv-2.4.8/build/install")
#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/windows/mods/mods-video/binary_desc/brisk/")
FIND_PACKAGE( OpenCV REQUIRED core imgproc highgui)
if (OPENCV_FOUND)
message("Found!")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenCV_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenCV_CXX_FLAGS}")
include_directories(${OpenCV_INDLUDE_DIRS})
message("${OpenCV_CXX_FLAGS}")
else(OPENCV_FOUND)
message("Not found!")
set(OpenCV_CXX_FLAGS "-L/usr/local/opencv-2-4-9/lib/")
include_directories(/usr/local/opencv-2.4.9/include)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenCV_CXX_FLAGS}")
link_directories(/usr/local/opencv-2.4.9/lib)
endif (OPENCV_FOUND)
#FIND_PACKAGE(CUDA REQUIRED)

enable_language (Fortran)
# set(LAPACK_DIR "${CMAKE_SOURCE_DIR}/lapack_for_windows")

FIND_PACKAGE(LAPACK)
if (LAPACK_FOUND)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LAPACK_CXX_FLAGS}")
else (LAPACK_FOUND)
link_directories(${CMAKE_SOURCE_DIR}/lapack_for_windows/lib)
include_directories(./lapack_for_windows/include)
endif (LAPACK_FOUND)


FIND_PACKAGE(OpenMP)
if (OPENMP_FOUND)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
endif (OPENMP_FOUND)

SET(CMAKE_BUILD_TYPE "RELEASE")

IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-strict-aliasing")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wno-write-strings")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -ansi")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -ftree-vectorize -funroll-loops")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)

#add_subdirectory( ./lib)
#include_directories(
#.
#./libdaisy/include
#./libdaisy/include/daisy
#)

add_subdirectory( ./inih)
add_subdirectory( ./matutls)
add_subdirectory( ./detectors)
add_subdirectory( ./detectors/affinedetectors)
add_subdirectory( ./detectors/mser )
add_subdirectory( ./opensurf )
add_subdirectory( ./libMatch)
add_subdirectory( ./libNumerics)
add_subdirectory( ./akaze)
add_subdirectory( ./mrogh)
#add_subdirectory( ./TILDE/c++)

####### DEGENSAC
include_directories(
.
./degensac)
set(degensac_srcs
degensac/DegUtils.c
degensac/exp_ranF.c
degensac/exp_ranH.c
degensac/Ftools.c
degensac/hash.c
degensac/Htools.c
degensac/ranF.c
degensac/ranH2el.c
degensac/ranH.c
degensac/rtools.c
degensac/utools.c
degensac/lapwrap.c
)
link_directories(${CMAKE_SOURCE_DIR}/lapack_for_windows/lib)

add_library(degensac ${degensac_srcs})
TARGET_LINK_LIBRARIES(degensac matutls lapack)
##### End of DEGENSAC

###################Matching
include_directories(.
./matching
)

set(matching_srcs
matching/siftdesc.cpp
matching/matching.cpp
orsa.cpp
)
link_directories(${CMAKE_SOURCE_DIR}/lapack_for_windows/lib)


add_library(matching ${matching_srcs})
TARGET_LINK_LIBRARIES(matching opencv_features2d248 opencv_core248 opencv_highgui248 degensac lapack Match Numerics)

################## View synthesis

set(synth-detection_srcs
synth-detection.cpp)

include_directories(.)

link_directories(c:/opencv-2.4.8/opencv-2.4.8/build/install/x86/mingw/lib)
add_library(synth-detection ${synth-detection_srcs})

TARGET_LINK_LIBRARIES(synth-detection matching opensurf
mser affinedetectors AKAZE helpers opencv_features2d248 opencv_core248 opencv_highgui248)

#include_directories(.
#./dali)
#./smsld)

link_directories(${CMAKE_SOURCE_DIR}/lapack_for_windows/lib)
link_directories(c:/opencv-2.4.8/opencv-2.4.8/build/install/x86/mingw/lib)
add_executable(mods mods.cpp correspondencebank.cpp imagerepresentation.cpp
io_mods.cpp ssdesc-cpp-1.1.1/ssdesc.cc)#smsld/wzhlib.cpp smsld/descriptor.cpp smsld/Match.cpp smsld/Image.cpp)

link_directories(${CMAKE_SOURCE_DIR}/lapack_for_windows/lib)
TARGET_LINK_LIBRARIES(mods inih matching synth-detection mser affinedetectors AKAZE mrogh
opencv_features2d248 opencv_core248 opencv_highgui248 m )

add_executable(extract_features extract_features.cpp correspondencebank.cpp imagerepresentation.cpp
io_mods.cpp ssdesc-cpp-1.1.1/ssdesc.cc) # smsld/wzhlib.cpp smsld/descriptor.cpp smsld/Match.cpp smsld/Image.cpp)
TARGET_LINK_LIBRARIES(extract_features inih matching synth-detection mser affinedetectors AKAZE mrogh
opencv_features2d248 opencv_core248 opencv_highgui248 m )
88 changes: 88 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
## MODS: Image Matching with On-Demand Synthesis.

Compilation.
MODS depends on OpenCV version 2.4.9 and LAPACK

## How to compile MODS on clean ubuntu 14.04 (tested on amazon AWS instance)

sudo apt-get install git cmake gfortran libblas-dev liblapack-dev build-essential gcc-multilib libopencv-dev python-opencv

sudo add-apt-repository --yes ppa:xqms/opencv-nonfree
sudo apt-get update
sudo apt-get install libopencv-nonfree-dev

if you want to use edge foci detector and bice descriptor from Microsoft, you will need to install wine as well:
sudo apt-get install wine
git clone
cd mods

cd vlfeat
make

cd ../build
cmake ..
make

## how to compile MODS on clean Windows 10
install cmake
https://cmake.org/download/

install mingw
http://www.mingw.org/

get lapack
https://icl.cs.utk.edu/lapack-for-windows/lapack/#libraries_mingw

add $mods_source_dir/lapack_for_windows/lib to your Path environment variable

install OpenCV 2.4.8
If you have trouble compiling it, use this solution http://stackoverflow.com/a/21214333

Add opencv install root/bin to your path environmental variable

Put opencv install root CMakeLists.txt to
SET (OpenCV_DIR "c:/opencv-2.4.8/opencv/sources/build/install")

cd build
cmake ..

Make sure, that CMake generates mingw32 make files, not Visual Studio.

mingw32-make

## Example of use:
Linux:
./mods examples/cat.png examples/cat2.png out1.png out2.png k1.txt k2.txt m.txt l.txt 0 1 examples/cat.txt config_iter_mods_cviu.ini iters_mods_cviu.ini

Windows:
./mods.exe examples/cat.png examples/cat2.png out1.png out2.png k1.txt k2.txt m.txt l.txt 0 1 examples/cat.txt config_iter_mods_cviu.ini iters_mods_cviu.ini


## Configurations:

config_iter_cviu.ini, iters_cviu.ini - version, created to hangle extreme view changes.

Described in
"MODS: Fast and Robust Method for Two-View Matching" by Dmytro Mishkin, Jiri Matas, Michal Perdoch.
http://arxiv.org/abs/1503.02619.

config_iter_wxbs.ini, iters_wxbs.ini - version, described in .

"WxBS: Wide Baseline Stereo Generalizations" by Dmytro Mishkin, Jiri Matas, Michal Perdoch, Karel Lenc.
http://arxiv.org/abs/1504.06603
It handles extreme appearance and geometrical changes. A bit slower than previous, but much more powerful.
If use, please cite corresponding papers.

## How to save detectors\descriptors and use them for matching
Note that exctract features takes only one step, so you may need to edit iters*.ini file to be able to extract features from next steps. See an example in iters_mods_cviu_onestep.ini

./extract_features examples/cat.png cat1.txt config_iter_cviu.ini iters_mods_cviu_onestep.ini
./extract_features examples/cat2.png cat2.txt config_iter_cviu.ini iters_mods_cviu_onestep.ini

Now loading and matching
./mods examples/cat.png examples/cat2.png out1.png out2.png cat1.txt cat2.txt m.txt l.txt 0 1 examples/cat.txt config_iter_mods_cviu.ini iters_mods_cviu_onestep.ini 1





26 changes: 26 additions & 0 deletions TILDE/c++/3rdParties/license_dollarToolBox.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright (c) 2012, Piotr Dollar
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.

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.

The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
Loading

0 comments on commit 41cfadc

Please sign in to comment.