ubuntu下 openMVG编译安装

参考:
https://zhuanlan.zhihu.com/p/85105925
https://blog.csdn.net/u012512679/article/details/53116641
官方安装步骤:
https://github.com/openMVG/openMVG/blob/master/BUILD.md#linux

1.下载下面的文件:

1.https://github.com/openMVG/openMVG
2.https://github.com/openMVG-thirdparty/cereal
3.https://github.com/openMVG-thirdparty/osi_clp
4.https://github.com/elmindreda/glfw
为什么要准备2 3 4,因为我使用下面的命令来下载openMVG时,会下载不成功,这些子包下载不下来,于是自己下载,然后放到指定位置:

git clone --recursive https://github.com/openMVG/openMVG.git

2.下载完后,把下载的子模块glfw 、osi_clp、cereal放置在openMVG下的/src/dependencies对应的文件夹中;

3.安装官方的安装步骤进行:https://github.com/openMVG/openMVG/blob/master/BUILD.md#linux

Compiling on Linux

  1. Install the required external libraries.
$ sudo apt-get install libpng-dev libjpeg-dev libtiff-dev libxxf86vm1 libxxf86vm-dev libxi-dev libxrandr-dev

If you want see the view graph svg logs, install Graphviz.

$ sudo apt-get install graphviz
  1. Checkout OpenMVG.
 git clone --recursive https://github.com/openMVG/openMVG.git
 mkdir openMVG_Build && cd openMVG_Build
  1. Configure and build
 cmake -DCMAKE_BUILD_TYPE=RELEASE ../openMVG/src/
 cmake --build . --target install

Run tests using make or ctest (if requested in the CMake command line with -DOpenMVG_BUILD_TESTS=ON)

 make test
 ctest --output-on-failure -j

  • 按照官网命令可能会出现如下问题:
[100%] Linking CXX executable ../../Linux-x86_64-RELEASE/openMVG_main_openMVG2WebGL
[100%] Built target openMVG_main_openMVG2WebGL
Install the project...
-- Install configuration: "RELEASE"
-- Up-to-date: /usr/local/include/openMVG_dependencies
CMake Error at cmake_install.cmake:36 (file):
  file INSTALL cannot set permissions on
  "/usr/local/include/openMVG_dependencies"


Makefile:71: recipe for target 'install' failed
make: *** [install] Error 1

请在执行下面的命令前加上 sudo 添加权限:
在这里插入图片描述

  • 另外,如果需要运行测试的程序,将上面图中第一行命令改为:

cmake -DCMAKE_BUILD_TYPE=RELEASE -DOpenMVG_BUILD_TESTS=ON ../openMVG/src/


openMVG的阅读文档:https://openmvg.readthedocs.io/en/latest/software/Geodesy/geodesy/#

openMVG在全局优化执行时,出现段错误:

yk@yk-B250-N:~/桌面/XAG_ZC1$ openMVG_main_GlobalSfM \
>   -P \
>   -i /home/yk/桌面/XAG_ZC1/images_output/sfm_data.json \
>   -m /home/yk/桌面/XAG_ZC1/images_output/matches/ \
>   -o /home/yk/桌面/XAG_ZC1/images_output/global_reconstruction

-----------------------------------------------------------
Global Structure from Motion:
-----------------------------------------------------------
Open Source implementation of the paper:
"Global Fusion of Relative Motions for Robust, Accurate and Scalable Structure from Motion."
Pierre Moulon, Pascal Monasse and Renaud Marlet.  ICCV 2013.
------------------------------------------------------------

- Features Loading -
0%   10   20   30   40   50   60   70   80   90   100%
|----|----|----|----|----|----|----|----|----|----|
***************************************************

CleanGraph_KeepLargestBiEdge_Nodes():: => connected Component: 1
Connected component of size: 27

- Relative pose computation -
0%   10   20   30   40   50   60   70   80   90   100%
|----|----|----|----|----|----|----|----|----|----|
********段错误 (核心已转储)

可能的解决方法:

使用自带的Ceres,不要使用之前自己安装的/usr/local/ 下的ceres, 修改方法:

openMVG/src/CMakeLists.txt 中 line:263 ,屏蔽找外部的Ceres

  # find_package(Ceres QUIET HINTS ${CERES_DIR_HINTS})    jxl: comment this to use internal ceres

你可能感兴趣的:(openMVG)