直接按照 build wiki 的步骤一步一步来就没问题。
# 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
# Checkout OpenMVG.
git clone --recursive https://github.com/openMVG/openMVG.git
# 设置编译和安装路径
cd openMVG
mkdir openmvg-build
mkdir openmvg-bin
cd openmvg-build
# Configure and build
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/path/to/openMVG/openmvg-bin ../src/
cmake --build . --target install
参考链接:
https://www.cnblogs.com/phillee/p/13085244.html
https://github.com/cdcseacave/openMVS/wiki/Building
因为wiki里面的指导不一定能安装成功。故做以下更改
#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.2
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
`此处更改`
# Build opencv from source
git clone https://github.com/opencv/opencv.git
cd opencv
git reset --hard 3.4.1
mkdir opencv-bin
mkdir opencv-build && cd opencv-build
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/path/to/opencv/opencv-bin ..
make -j8
make install
`以下不变`
#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 -j8 && sudo make install
cd ..
#GLFW3 (Optional)
sudo apt-get -y install freeglut3-dev libglew-dev libglfw3-dev
此处使用的是我自己的Boost、OpenCV、VCG路径
#OpenMVS
git clone https://github.com/cdcseacave/openMVS.git openMVS
cd openMVS
mkdir openmvs-build && cd openmvs-build
cmake -DOpenCV_DIR=/home/wya/Project/opencv-3.4.13/build/ -DCMAKE_BUILD_TYPE=Release -DVCG_ROOT=/home/wya/Project/vcglib -DBOOST_ROOT=/home/wya/Project/boost_1_64_0 -DBUILD_SHARED_LIBS=ON ..
#If something goes wrong, try to set shared libs OFF
#Install OpenMVS library (optional):
make -j8
sudo make install
[100%] Linking CXX executable ../../bin/Viewer
/usr/bin/ld: CMakeFiles/Viewer.dir/Image.cpp.o: undefined refere
nce to symbol '_ZN2cv6resizeERKNS_11_InputArrayERKNS_12_OutputAr
rayENS_5Size_IiEEddi'
//root/misc_codes/opencv/opencv-bin/lib/libopencv_imgproc.so.3.4
: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
apps/Viewer/CMakeFiles/Viewer.dir/build.make:229: recipe for tar
get 'bin/Viewer' failed
make[2]: *** [bin/Viewer] Error 1
CMakeFiles/Makefile2:732: recipe for target 'apps/Viewer/CMakeFi
les/Viewer.dir/all' failed
make[1]: *** [apps/Viewer/CMakeFiles/Viewer.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
openMVS的git issue里面提到的思路或许能解决问题
in CMakeList.txt, add lines like below (replace {{target_name}} to your own):
find_package(Boost COMPONENTS system filesystem REQUIRED)
target_link_libraries({{target_name}} ${Boost_FILESYSTEM_LIBRARY})
target_link_libraries({{target_name}} ${Boost_SYSTEM_LIBRARY})
实际解决时,在每一个模块下面的CMakeLists.txt中添加动态链接库
error: "There is no defined intrinsic data in order to compute an essential matrix for the initial pair."
解决方案
参考 openMVS git issue
至此配置完成,找一些数据如Middlebury dino/temple、DTU scan9、ETHD Pipes、Strecha fountain-P11等就可以运行测试了。
In order to use OpenMVS as a third-party libray in your project, first compile it as described above or simply use vcpgk
:
vcpkg install openmvs
And inside your project CMake script, use:
find_package(OpenMVS)
if(OpenMVS_FOUND)
include_directories(${OpenMVS_INCLUDE_DIRS})
add_definitions(${OpenMVS_DEFINITIONS})
endif()
add_executable(your_project source_code.cpp)
target_link_libraries(your_project PRIVATE OpenMVS::MVS)