1. openMVG
比較簡單,直接按照 build wiki 的步驟一步一步來就沒問題。
Instruction: Build on Linux
# 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
2. openMVS
2.1 這一步就比較麻煩了,因為wiki里面的指導不一定能安裝成功。
# Prepare and empty machine for building apt-get update && apt-get install -qq apt-get -y install build-essential git mercurial cmake libpng-dev libjpeg-dev libtiff-dev libglu1-mesa-dev libxmu-dev libxi-dev
#Boost (Required) apt-get -y install libboost-iostreams-dev libboost-program-options-dev libboost-system-dev libboost-serialization-dev
#Eigen (Required) git clone https://gitlab.com/libeigen/eigen.git --branch 3.3 cd eigen mkdir eigen-build && cd eigen-build cmake . .. -CMAKE_INSTALL_PREFIX=/path/to/eigen/eigen-bin make && make install cd ../..
2.2 下面這一步可能會出現問題,最好自己下載源碼編譯
#OpenCV (Required) apt-get -y install libopencv-dev
# 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
2.3 接下來的兩個庫直接按步驟就可以
#CGAL (Required) apt-get -y install libcgal-dev libcgal-qt5-dev #VCGLib (Required) git clone https://github.com/cdcseacave/VCG.git vcglib
#Ceres (Required) apt-get -y install libatlas-base-dev libsuitesparse-dev # If google source encounter connection time out, try github # git clone https://ceres-solver.googlesource.com/ceres-solver ceres-solver git clone https://github.com/ceres-solver/ceres-solver.git cd ceres-solver git reset --hard 1.14.0 mkdir ceres-bin mkdir ceres-build && cd ceres-build cmake . ../ -DMINIGLOG=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF make -j2 && sudo make install cd ../.. #GLFW3 (Optional) apt-get -y install freeglut3-dev libglew-dev libglfw3-dev
2.4 進入主要步驟
#OpenMVS git clone https://github.com/cdcseacave/openMVS.git openMVS cd openMVS mkdir openmvs-bin mkdir openmvs-build && cd openmvs-build cmake . ../ -DCMAKE_BUILD_TYPE=Release -DVCG_ROOT="/path/to/vcglib" -DBUILD_SHARED_LIBS=ON #If something goes wrong, try to set shared libs OFF #Install OpenMVS library (optional): make -j8 && make install
2.5 make的過程中出現undefined reference錯誤記錄如下
[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中添加動態鏈接庫
# openMVS/apps/InterfaceCOLMAP/CMakeLists.txt cxx_executable_with_flags_no_pch(InterfaceCOLMAP "Apps" "${cxx_default}" "MVS;${OpenMVS_EXTRA_LIBS}" ${LIBRARY_FILES_C} ${LIBRARY_FILES_H}) target_link_libraries(InterfaceCOLMAP ${OpenCV_LIBRARIES} ${Boost_LIBRARIES} )
2.6 運行過程中遇到以下的問題
error: "There is no defined intrinsic data in order to compute an essential matrix for the initial pair."
解決方案
至此配置完成,找一些數據如Middlebury dino/temple、DTU scan9、ETHD Pipes、Strecha fountain-P11等就可以運行測試了。