ubuntu20.04安装openMVG和openMVS

2022/7/7 5:21:29

本文主要是介绍ubuntu20.04安装openMVG和openMVS,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1、安装openMVG

主要按照官方教程安装基本上不会出错:

https://github.com/openMVG/openMVG/blob/develop/BUILD.md#using-openmvg-as-a-third-party-library-dependency-with-cmake

有问题可以查找:

https://github.com/openMVG/openMVG/issues

主要过程:

$ sudo apt-get install libpng-dev libjpeg-dev libtiff-dev libxxf86vm1 libxxf86vm-dev libxi-dev libxrandr-dev

$ sudo apt-get install graphviz
$ cd library

$ git clone --recursive https://github.com/openMVG/openMVG.git
$ cd openMVG
$ mkdir openMVG_Build && cd openMVG_Build

$ cmake -DCMAKE_BUILD_TYPE=RELEASE ../src/  -DOpenMVG_BUILD_TESTS=ON
$ cmake --build . --target install

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

 

2、安装openMVS

安装步骤主要按照官方文档:https://github.com/cdcseacave/openMVS/wiki/Building

有问题可以查找:https://github.com/cdcseacave/openMVS/issues

#Prepare and empty machine for building:
sudo apt-get update -qq && sudo apt-get install -qq
sudo apt-get -y install git cmake libpng-dev libjpeg-dev libtiff-dev libglu1-mesa-dev
main_path=`pwd`

#Eigen (Required)
git clone https://gitlab.com/libeigen/eigen.git --branch 3.4
mkdir eigen_build && cd eigen_build
cmake . ../eigen
make && sudo make install
cd ..

#Boost (Required)
sudo apt-get -y install libboost-iostreams-dev libboost-program-options-dev libboost-system-dev libboost-serialization-dev

#OpenCV (Required)
sudo apt-get -y install libopencv-dev

#CGAL (Required)
sudo apt-get -y install libcgal-dev libcgal-qt5-dev

#VCGLib (Required)
git clone https://github.com/cdcseacave/VCG.git vcglib

#Ceres (Optional)
sudo apt-get -y install libatlas-base-dev libsuitesparse-dev
git clone https://ceres-solver.googlesource.com/ceres-solver ceres-solver
mkdir ceres_build && cd ceres_build
cmake . ../ceres-solver/ -DMINIGLOG=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF
make -j2 && sudo make install
cd ..

#GLFW3 (Optional)
sudo apt-get -y install freeglut3-dev libglew-dev libglfw3-dev

#OpenMVS
git clone https://github.com/cdcseacave/openMVS.git openMVS
cd openMVS
mkdir openMVS_build && cd openMVS_build
cmake . ../openMVS -DCMAKE_BUILD_TYPE=Release -DVCG_ROOT="$main_path/vcglib"

#If you want to use OpenMVS as shared library, add to the CMake command:
-DBUILD_SHARED_LIBS=ON(这一句最好不要加,不然之后安装可能一直安装不上)

#Install OpenMVS library (optional):
make -j2 && sudo make install

如果按照官方文档安装出现错误,可以查看你安装的库的版本是否符合要求

    Eigen version 3.4 or higher
    OpenCV version 2.4 or higher
    Ceres version 1.10 or higher
    CGAL version 4.2 or higher
    Boost version 1.56 or higher
    VCG
    GLFW

关于遇到的问题:

1、

/home/zll/library/openMVS/libs/MVS/PatchMatchCUDA.cu(267): error: calling a __host__ function("Eigen::MatrixBase< ::Eigen::Matrix<float, (int)3, (int)3, (int)0, (int)3, (int)3> > ::inverse() const") from a __device__ function("ComputeHomography") is not allowed
/home/zll/library/openMVS/libs/MVS/PatchMatchCUDA.cu(267): error: identifier "Eigen::MatrixBase< ::Eigen::Matrix<float, (int)3, (int)3, (int)0, (int)3, (int)3> > ::inverse const" is undefined in device code
errors detected in the compilation of "/home/zll/library/openMVS/libs/MVS/PatchMatchCUDA.cu".

make[2]: *** [libs/MVS/CMakeFiles/MVS.dir/build.make:317:libs/MVS/CMakeFiles/MVS.dir/PatchMatchCUDA.cu.o] 错误 1

make[2]: *** 正在等待未完成的任务....

解决方法:

Eigen3.3.9不行,换Eigen3.4

https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.zip

2、

/usr/bin/ld: CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o: undefined reference to symbol '_ZTVN7SEACAVE6CImageE'
/usr/bin/ld: /home/zll/library/openMVS/openMVS_build/lib/libIO.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
/usr/bin/ld: CMakeFiles/InterfaceMetashape.dir/InterfaceMetashape.cpp.o: undefined reference to symbol '_ZNK8tinyxml27XMLNode17FirstChildElementEPKc'
/usr/bin/ld: /home/zll/library/openMVS/openMVS_build/lib/libIO.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

解决方法:

cmake时去掉 -DBUILD_SHARED_LIBS=ON

 


参考博客:https://blog.csdn.net/rdw1246010462/article/details/122219814

 

      https://github.com/cdcseacave/openMVS/issues/346

 



这篇关于ubuntu20.04安装openMVG和openMVS的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程