Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ahojnnes committed Apr 7, 2016
0 parents commit fe8f82a
Show file tree
Hide file tree
Showing 511 changed files with 344,010 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Custom files
LocalConfig.cmake

# Custom directories
.idea/
.DS_Store
build-debug/
build-release/
data/
doc/_build

# Compiled Object files
*.slo
*.lo
*.o
*.obj
*.pyc

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
146 changes: 146 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
cmake_minimum_required(VERSION 2.8)

project(COLMAP)
add_definitions("-DCOLMAP_VERSION=\"1.0\"")


################################################################################
# Include CMake dependencies
################################################################################

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

include(CheckCXXCompilerFlag)

# Include helper macros and commands, and allow the included file to override
# the CMake policies in this file
include(${CMAKE_SOURCE_DIR}/cmake/cmake_helper.cmake NO_POLICY_SCOPE)

if(EXISTS ${CMAKE_SOURCE_DIR}/LocalConfig.cmake)
include(${CMAKE_SOURCE_DIR}/LocalConfig.cmake)
endif()


################################################################################
# Options
################################################################################

enable_testing()

option(OPENMP_ENABLED "Whether to enable OpenMP" ON)
option(LTO_ENABLED "Whether to enable link-time optimization" ON)
option(CUDA_ENABLED "Whether to enable CUDA, if available" ON)

set(Boost_USE_STATIC_LIBS ON)


################################################################################
# Find packages
################################################################################

if(OPENMP_ENABLED)
find_package(OpenMP QUIET)
endif()

find_package(Boost COMPONENTS
program_options
filesystem
system
chrono
regex
unit_test_framework
REQUIRED)

find_package(Eigen3 REQUIRED)

find_package(FreeImage REQUIRED)

find_package(Glog REQUIRED)

find_package(Ceres REQUIRED)

find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
find_package(Glew REQUIRED)

if(CUDA_ENABLED)
find_package(CUDA QUIET)
endif()

find_package(Qt5Core REQUIRED)
find_package(Qt5OpenGL REQUIRED)


################################################################################
# Compiler specific configuration
################################################################################

if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Build type not specified, using RelWithDebInfo")
set(CMAKE_BUILD_TYPE RelWithDebInfo)
set(IS_DEBUG TRUE)
endif()

if(IS_MSVC)
add_definitions("-DGLOG_NO_ABBREVIATED_SEVERITIES")
add_definitions("-DGL_GLEXT_PROTOTYPES")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter")
endif()


if(OPENMP_ENABLED AND OPENMP_FOUND)
add_definitions("-DOPENMP_ENABLED")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
else()
message(STATUS "Disabling OpenMP support")
endif()

if(LTO_ENABLED AND NOT IS_DEBUG AND NOT IS_GNU)
CHECK_CXX_COMPILER_FLAG("-flto" HAS_LTO)
if(HAS_LTO)
message(STATUS "Enabling link-time optimization (-flto)")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
endif()
else()
message(STATUS "Disabling link-time optimization (-flto)")
endif()

if(CUDA_FOUND)
if(CUDA_ENABLED)
add_definitions("-DCUDA_ENABLED")
message(STATUS "Enabling CUDA support")
else()
set(CUDA_FOUND FALSE)
message(STATUS "Disabling CUDA support")
endif()
else()
set(CUDA_ENABLED FALSE)
message(STATUS "Disabling CUDA support")
endif()

# Qt5 was built with -reduce-relocations.
if(Qt5_POSITION_INDEPENDENT_CODE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()


################################################################################
# Add sources
################################################################################

add_subdirectory(src)


################################################################################
# Uninstall script
################################################################################

configure_file("${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
set_target_properties(uninstall PROPERTIES FOLDER ${CMAKE_TARGETS_ROOT_FOLDER})
32 changes: 32 additions & 0 deletions LocalConfigExample.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This is an example of a LocalConfig.cmake file. This is useful on Windows
# platforms, where CMake cannot find many of the libraries automatically and
# it is tedious to set their paths manually in the GUI. To use this file, copy
# and rename it to LocalConfig.cmake

message(STATUS "NOTE: Using LocalConfig.cmake to override CMake settings in the GUI")

set(Ceres_DIR "<ceres-solver-dir>/build/install/CMake" CACHE PATH "" FORCE)

set(EIGEN3_INCLUDE_DIRS "<Eigen-dir>" CACHE PATH "" FORCE)

set(GLOG_INCLUDE_DIR_HINTS "<glog-dir>/src/windows" CACHE PATH "" FORCE)
set(GLOG_LIBRARY_DIR_HINTS "<glog-dir>/x64/Release" CACHE FILEPATH "" FORCE)

set(BOOST_ROOT "<boost-dir>" CACHE PATH "" FORCE)
set(BOOST_LIBRARYDIR "<boost-lib-dir>" CACHE PATH "" FORCE)

set(OPENGL_gl_LIBRARY "opengl32" CACHE STRING "" FORCE)
set(OPENGL_glu_LIBRARY "glu32" CACHE STRING "" FORCE)

set(GLUT_INCLUDE_DIR "<freeglut-dir>/include" CACHE PATH "" FORCE)
set(GLUT_glut_LIBRARY "<freeglut-dir>/lib/freeglut.lib" CACHE FILEPATH "" FORCE)

set(GLEW_INCLUDE_DIR_HINTS "<glew-dir>/include" CACHE PATH "" FORCE)
set(GLEW_LIBRARY_DIR_HINTS "<glew-dir>/lib/Release/x64" CACHE FILEPATH "" FORCE)

set(Qt5_CMAKE_DIR "<Qt-precompiled-dir>/lib/cmake" CACHE PATH "" FORCE)
set(Qt5Core_DIR ${Qt5_CMAKE_DIR}/Qt5Core CACHE PATH "" FORCE)
set(Qt5OpenGL_DIR ${Qt5_CMAKE_DIR}/Qt5OpenGL CACHE PATH "" FORCE)

set(FREEIMAGE_INCLUDE_DIR_HINTS "<FreeImage-dir>/Dist/x64" CACHE PATH "" FORCE)
set(FREEIMAGE_LIBRARY_DIR_HINTS "<FreeImage-dir>/Dist/x64" CACHE PATH "" FORCE)
92 changes: 92 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
COLMAP
======

COLMAP is a general-purpose Structure-from-Motion pipeline with a graphical and
command-line interface. It offers a wide range of features for reconstruction of
ordered and unordered image collections. The software is licensed under the GNU
General Public License. If you use this project for your research, please cite:

@inproceedings{schoenberger2016sfm,
author = {Sch\"{o}nberger, Johannes Lutz and Frahm, Jan-Michael},
title = {Structure-from-Motion Revisited},
booktitle={IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
year={2016},
}


Getting Started
---------------

1. Download the pre-built binaries from
https://drive.google.com/folderview?id=0B_oNOlzQHU_Ha2hkdlRQYzQ4RDA#list
or build the library manually as described in the documentation.
2. Watch the short introductory video at
https://www.youtube.com/watch?v=P-EC0DzeVEU or read the tutorial
in the documentation for more details.


Documentation
-------------

The documentation is available at https://colmap.github.io/.


Support
-------

Please, use the GitHub issue tracker at https://github.com/colmap/colmap for bug
reports, questions, suggestions, etc.


Contribution
------------

Contributions (bug reports, bug fixes, improvements, etc.) are very welcome and
should be submitted in the form of new issues and/or pull requests on GitHub.

Please, adhere to the Google coding style guide:

http://google-styleguide.googlecode.com/svn/trunk/cppguide.html

by using the provided ".clang-format" file.

Document functions, methods, classes, etc. with inline documentation strings
describing the API, using the following format:

// Short description.
//
// Longer description with a few sentences and multiple lines.
//
// @param parameter1 Description for parameter 1.
// @param parameter2 Description for parameter 2.
//
// @return Description of optional return value.

Add unit tests for all newly added code and make sure that algorithmic
"improvements" generalize and actually improve the results of the pipeline on a
variety of datasets.


License
-------

The software is licensed under the GNU General Public License v3 or later. If
you are interested in licensing the software for commercial purposes, without
disclosing your modifications, please contact the authors.


COLMAP - Structure-from-Motion.
Copyright (C) 2016 Johannes L. Schoenberger <jsch at cs.unc.edu>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
79 changes: 79 additions & 0 deletions cmake/FindEigen3.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Sets:
# EIGEN3_FOUND - TRUE if System has Eigen library with correct version.
# EIGEN3_INCLUDE_DIRS - The Eigen include directory.
# EIGEN3_VERSION - Eigen version.

if(NOT Eigen3_FIND_VERSION)
if(NOT Eigen3_FIND_VERSION_MAJOR)
set(Eigen3_FIND_VERSION_MAJOR 2)
endif()

if(NOT Eigen3_FIND_VERSION_MINOR)
set(Eigen3_FIND_VERSION_MINOR 91)
endif()

if(NOT Eigen3_FIND_VERSION_PATCH)
set(Eigen3_FIND_VERSION_PATCH 0)
endif()

set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
endif()

macro(_eigen3_check_version)
file(READ "${EIGEN3_INCLUDE_DIRS}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)

string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")

set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
set(EIGEN3_VERSION_OK FALSE)
else()
set(EIGEN3_VERSION_OK TRUE)
endif()

if(NOT EIGEN3_VERSION_OK)
message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIRS}, "
"but at least version ${Eigen3_FIND_VERSION} is required.")
endif()
endmacro()

if(EIGEN3_INCLUDE_DIRS)
_eigen3_check_version()
set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
else()
find_path(EIGEN3_INCLUDE_DIRS
NAMES
signature_of_eigen3_matrix_library
PATHS
/usr/include
/usr/local/include
/opt/include
/opt/local/include
PATH_SUFFIXES
eigen3
eigen
)

if(EIGEN3_INCLUDE_DIRS)
_eigen3_check_version()
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIRS EIGEN3_VERSION_OK)

mark_as_advanced(EIGEN3_INCLUDE_DIRS)
endif()

if(EIGEN3_FOUND)
message(STATUS "Found Eigen3")
message(STATUS " Includes : ${EIGEN3_INCLUDE_DIRS}")
else()
if(Eigen3_FIND_REQUIRED)
message(FATAL_ERROR "Could not find Eigen3")
endif()
endif()
Loading

0 comments on commit fe8f82a

Please sign in to comment.