openMVG (open Multiple View Geometry) is a classic open source 3D reconstruction algorithm library. This article mainly introduces the installation and compilation method of OpenMVG library in Linux system.
Code address: github
Official documentation: DOC
The installation steps are as follows:
1. Download the source code. One way is to use git clone to download. The other way is to download zip directly. The former is recommended. The latter cannot completely download the dependent library files, causing the compilation to fail. recursive can recursively download dependent libraries.
git clone --recursive https://github.com/openMVG/openMVG.git
After the download is complete, be sure to confirm that these three folders in the dependencies folder are not empty!
Otherwise, an error will be reported during compilation: " submodule(s) are missing" or "The submodule is not registered for the path . " Solution: Blog , or separately git clone the library that failed to download, and put it in the corresponding folder.
2. Dependency library installation
sudo apt-get install libpng-dev libjpeg-dev libtiff-dev libxxf86vm1 libxxf86vm-dev libxi-dev libxrandr-dev
sudo apt-get install graphviz
Of course, the algorithm also relies on Eigen3.4.0, ceres-solver and other libraries, which can be installed by yourself.
3. Compile
Create a folder and place the downloaded source code in the folder. Use cmake to compile. If there are no accidents, the compilation will be successful.
mkdir openMVG_Build && cd openMVG_Build
cmake -DCMAKE_BUILD_TYPE=RELEASE -DOpenMVG_BUILD_TESTS=ON -DOpenMVG_BUILD_EXAMPLES=ON . ../openMVG/src/
make
4. Error reporting and resolution
(1)submodule(s) are missing
Solution: lianqi1008’s blog .
(2) Eigen version is too low
Error message:
/usr/include/eigen3/Eigen/SparseCholesky:34:2: error: #error The SparseCholesky module has nothing to offer in MPL2 only mode #error The SparseCholesky module has nothing to offer in
MPL2 only mode
Solution: Reinstall/upgrade eigen , or modify line 280 of the Cmakelist file . I use the latter. After all, other algorithms in the Eigen library are also used. Upgrading the version may cause the compilation of other algorithms to fail. Modify it as follows so that it uses the built-in Eigen library instead of the system Eigen.