Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/openMVG/openMVG into dev…
Browse files Browse the repository at this point in the history
…elop
  • Loading branch information
pmoulon committed Jun 10, 2018
2 parents e887fad + 03f1eba commit de5c12a
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 88 deletions.
149 changes: 71 additions & 78 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,61 @@ Required tools:
- Git
- C/C++ compiler (GCC, Visual Studio or Clang)


Optional tools:

- QT version >= v5.4

Getting the sources (and the submodules):
```shell
$ git clone --recursive https://github.com/openMVG/openMVG.git
```
or
```shell
$ git clone https://github.com/openMVG/openMVG.git
$ cd openMVG
$ git submodule init
$ git submodule update
```

As OpenMVG uses some C++11 features, you must have a C++11 ready compiler:

- Visual Studio >= 2015 (recommended)
- GCC >= 4.8.1
- Clang >= 3.3

General information for OpenMVG CMake options:
Note:

- OpenMVG_BUILD_TESTS (ON/OFF(default))
- Build OpenMVG unit tests
- OpenMVG_BUILD_EXAMPLES (ON/OFF(default))
- Build OpenMVG example applications.
- CMAKE OpenMVG variables you can configure:

Note: options does not affect binaries under 'software'
- OpenMVG_BUILD_TESTS (ON/OFF(default))
- Build OpenMVG unit tests
- OpenMVG_BUILD_EXAMPLES (ON/OFF(default))
- Build OpenMVG example applications.
- OpenMVG_BUILD_SOFTWARES (ON(default)/OFF)
- Build OpenMVG applications.

- General information for OpenMVG SfM pipelines:

General information for OpenMVG SfM pipelines:
- OpenMVG can export graphs as Graphviz .dot files and render them as SVG files. If you want this graph visualization feature, please install Graphviz.

- OpenMVG can export graphs as Graphviz .dot files and render them as SVG files. If you want this graph visualization feature, please install Graphviz.
Checking out the project and build it
--------------------------------------

Compilation
----------------
- [Getting the project](#checkout)
- [Compiling on Linux](#linux)
- [Compiling on Windows](#windows)
- [Compiling on MacOS](#macos)
- [Compiling using VCPKG](#vcpkg)

- [Linux](#linux)
- [Windows](#windows)
- [MacOS](#macos)
Getting the project
--------------------
<a name="checkout"></a>

Getting the sources (and the submodules):
```shell
$ git clone --recursive https://github.com/openMVG/openMVG.git
```
or
```shell
$ git clone https://github.com/openMVG/openMVG.git
$ cd openMVG
$ git submodule init
$ git submodule update
```

Linux compilation
-----------------
Compiling on Linux
-------------------
<a name="linux"></a>

Install the required external libraries.
1. Install the required external libraries.
```shell
$ sudo apt-get install libpng-dev libjpeg-dev libtiff-dev libxxf86vm1 libxxf86vm-dev libxi-dev libxrandr-dev
```
Expand All @@ -68,53 +73,29 @@ If you want see the view graph svg logs, install Graphviz.
$ sudo apt-get install graphviz
```

Build OpenMVG.
2. Checkout OpenMVG.
```shell
$ git clone --recursive https://github.com/openMVG/openMVG.git
$ cd openMVG
$ ls
AUTHORS BUILD docs logo README src ...
$ cd ..
$ mkdir openMVG_Build
$ cd openMVG_Build
```
If you want to add unit tests and examples to the build, run
```shell
$ cmake -DCMAKE_BUILD_TYPE=RELEASE -DOpenMVG_BUILD_TESTS=ON -DOpenMVG_BUILD_EXAMPLES=ON . ../openMVG/src/
```
otherwise
```shell
$ cmake -DCMAKE_BUILD_TYPE=RELEASE . ../openMVG/src/
```
If you want to have an IDE openable project with Code::Blocks:
```shell
$ cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE . ../openMVG/src/
$ mkdir openMVG_Build && cd openMVG_Build
```

Compile the project
```shell
$ make
```
or for a multi-core compilation. (Replace NBcore with the number of threads)
3. Configure and build
```shell
$ make -j NBcore
$ cmake -DCMAKE_BUILD_TYPE=RELEASE ../openMVG/src/
$ cmake --build . --target install
```

Run tests (if requested at CMake step)
Run tests using make or ctest (if requested in the CMake command line with `-DOpenMVG_BUILD_TESTS=ON`)
```shell
$ make test
$ ctest --output-on-failure -j
```

Have fun with the samples
```shell
$ cd openMVG_Samples
```

Windows compilation
-------------------
Compiling on Windows
---------------------
<a name="windows"></a>

Checkout the project
1. Checkout the project
```shell
$ git clone --recursive https://github.com/openMVG/openMVG.git
```
Expand All @@ -127,17 +108,9 @@ $ git clone --recursive https://github.com/openMVG/openMVG.git
6. Change the target to Release.
7. Compile the libraries and binaries samples.

Another options is to build with cmake in console. I recommend launching `VS2015 x64 Native Tools Command Prompt` which has build environment already set up.

```shell
git clone --recursive https://github.com/openMVG/openMVG.git
mkdir openMVG-build
cd openMVG-build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="c:/openMVG" -G "NMake Makefiles" ../openMVG/src/
cmake --build . --target install
```
Another options is to build with cmake in console. I recommend launching `VS2015/VS2017 x64 Native Tools Command Prompt` which has build environment already set up or to use the [VCPKG](#vcpkg) alternative.

Mac compilation
Compiling on Mac
-------------------
<a name="macos"></a>

Expand All @@ -156,14 +129,35 @@ If you want to use Xcode and compile by using the command line, run
$ cmake -DCMAKE_BUILD_TYPE=RELEASE -G "Xcode" . ../openMVG/src/
$ xcodebuild -configuration Release
```
If you want to add unit tests and examples to the build, run
otherwise you can use standard makefiles
```shell
$ cmake -DCMAKE_BUILD_TYPE=RELEASE -DOpenMVG_BUILD_TESTS=ON -DOpenMVG_BUILD_EXAMPLES=ON -G "Xcode" . ../openMVG/src/
$ cmake -DCMAKE_BUILD_TYPE=RELEASE . ../openMVG/src/
```

otherwise you can use standard makefiles
Compiling using VCPKG
-----------------------
<a name="vcpkg"></a>

Checking and build VCPKG
```shell
$ cmake -DCMAKE_BUILD_TYPE=RELEASE . ../openMVG/src/
$ git clone https://github.com/Microsoft/vcpkg
$ cd vcpkg
$ ./bootstrap-vcpkg.sh/bat
```

Checking OpenMVG 3rd party dependencies by using VCPKG (configure your build triplet if needed see `--triplet`)
```shell
$ ./vcpkg install cereal ceres eigen3 libjpeg-turbo libpng tiff
```
Note: If you want to use ceres with a sparse back end, please use one of this choice `ceres[cxsparse]` or `ceres[suitesparse]` or `ceres[eigensparse]`.

Checking out OpenMVG and build it
```shell
$ git clone --recursive https://github.com/openMVG/openMVG.git
$ mkdir openMVG_Build
$ cd openMVG_Build
$ cmake ../openMVG/src/ -DCMAKE_TOOLCHAIN_FILE=<VCPK_ROOT>/scripts/buildsystems/vcpkg.cmake
$ cmake --build .
```

Using OpenCV sample
Expand Down Expand Up @@ -210,4 +204,3 @@ Specify in CMake where OpenMVG has been installed by using the CMake OpenMVG_DIR
e.g. `-DOpenMVG_DIR:STRING="YourInstallPath"/share/openMVG/cmake`

A message will be displayed if OpenMVG is found or not at the CMake configure step.

23 changes: 14 additions & 9 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,34 +228,39 @@ ENDMACRO(UNIT_TEST)
# ==============================================================================
# cereal
# ==============================================================================
# - internal by default,
# - external if CEREAL_INCLUDE_DIR_HINTS is defined
# - external by default
# - internal if cereal not found
# ==============================================================================
if (NOT DEFINED CEREAL_INCLUDE_DIR_HINTS)
find_package(cereal QUIET CONFIG)
if (NOT cereal_FOUND)
set(CEREAL_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/dependencies/cereal/include)
set(OpenMVG_USE_INTERNAL_CEREAL ON)
else()
set(CEREAL_INCLUDE_DIRS ${CEREAL_INCLUDE_DIR_HINTS})
get_target_property(CEREAL_INCLUDE_DIRS cereal INTERFACE_INCLUDE_DIRECTORIES)
endif()

# ==============================================================================
# Eigen
# ==============================================================================
# - internal by default,
# - external by default
# - external if EIGEN_INCLUDE_DIR_HINTS is defined
# - internal if Eigen not found
# ==============================================================================
if (NOT DEFINED EIGEN_INCLUDE_DIR_HINTS)
find_package(eigen3 QUIET)
if (NOT eigen3_FOUND)
set(EIGEN_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/eigen)
set(OpenMVG_USE_INTERNAL_EIGEN ON)
find_package(Eigen QUIET)
else()
set(EIGEN_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
endif()
find_package(Eigen QUIET)

# ==============================================================================
# Ceres
# ==============================================================================
# - internal by default (ceres-solver+cxsparse+miniglog),
# - external if CERES_DIR_HINTS and find_package return a valid Ceres setup
# - external by default if CERES_DIR_HINTS or find_package found a valid Ceres
# - internal if ceres not found (ceres-solver+cxsparse+miniglog)
# ==============================================================================
find_package(Ceres QUIET HINTS ${CERES_DIR_HINTS})
if (NOT Ceres_FOUND)
Expand Down
2 changes: 2 additions & 0 deletions src/openMVG/multiview/rotation_averaging_l2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@ bool L2RotationAveraging_Refine
}
#ifdef OPENMVG_USE_OPENMP
solverOptions.num_threads = omp_get_max_threads();
#if CERES_VERSION_MAJOR < 2
solverOptions.num_linear_solver_threads = omp_get_max_threads();
#endif
#endif // OPENMVG_USE_OPENMP

ceres::Solver::Summary summary;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ bool solve_translations_problem_l2_chordal
Solver::Options options;
#ifdef OPENMVG_USE_OPENMP
options.num_threads = omp_get_max_threads();
#if CERES_VERSION_MAJOR < 2
options.num_linear_solver_threads = omp_get_max_threads();
#endif
#endif // OPENMVG_USE_OPENMP
options.minimizer_progress_to_stdout = false;
options.logging_type = ceres::SILENT;
Expand Down
2 changes: 2 additions & 0 deletions src/openMVG/multiview/translation_averaging_solver_softl1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ bool solve_translations_problem_softl1
options.logging_type = ceres::SILENT;
#ifdef OPENMVG_USE_OPENMP
options.num_threads = omp_get_max_threads();
#if CERES_VERSION_MAJOR < 2
options.num_linear_solver_threads = omp_get_max_threads();
#endif
#endif // OPENMVG_USE_OPENMP
ceres::Solver::Summary summary;
ceres::Solve(options, &problem, &summary);
Expand Down
2 changes: 2 additions & 0 deletions src/openMVG/sfm/sfm_data_BA_ceres.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,9 @@ bool Bundle_Adjustment_Ceres::Adjust
ceres_config_options.minimizer_progress_to_stdout = ceres_options_.bVerbose_;
ceres_config_options.logging_type = ceres::SILENT;
ceres_config_options.num_threads = ceres_options_.nb_threads_;
#if CERES_VERSION_MAJOR < 2
ceres_config_options.num_linear_solver_threads = ceres_options_.nb_threads_;
#endif
ceres_config_options.parameter_tolerance = ceres_options_.parameter_tolerance_;

// Solve BA
Expand Down
4 changes: 3 additions & 1 deletion src/openMVG/sfm/sfm_data_BA_ceres_camera_functor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#ifndef OPENMVG_SFM_SFM_DATA_BA_CERES_CAMERA_FUNCTOR_HPP
#define OPENMVG_SFM_SFM_DATA_BA_CERES_CAMERA_FUNCTOR_HPP

#include <memory>

#include <ceres/ceres.h>
#include <ceres/rotation.h>

Expand Down Expand Up @@ -83,7 +85,7 @@ struct WeightedCostFunction
return false;
}

ceres::internal::scoped_ptr<CostFunctor> functor_;
std::unique_ptr<CostFunctor> functor_;
const double weight_;
};

Expand Down

0 comments on commit de5c12a

Please sign in to comment.