三维重建openMVS-Gpu cuda11.4 win10 vs2019 cmake3.23.1 vcpkg编译安装

本机环境如下:

名称 版本
cuda 11.4
vs2019
cmake 3.23.1
boost 1.79.0
cgal 5.4
glew 2.2.0
eigen3 3.4.0
glew 2.2.0
glfw3 3.3.7
gmp 6.2.1
mpfr 4.1.0
opencv4 4.5.5
zlib 1.2.12

OpenMVS官方给的安装步骤如下:

#Make a toplevel directory for deps & build & src somewhere:
mkdir OpenMVS
cd OpenMVS

#Get and install dependencies using vcpkg;
#choose the desired triplet, like "x64-windows", by setting the VCPKG_DEFAULT_TRIPLET environment variable or by specifying it after each package:
vcpkg install zlib boost-iostreams boost-program-options boost-system boost-serialization eigen3 cgal[core] opencv glew glfw3

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

#Get and unpack OpenMVS in OpenMVS/src:
git clone https://github.com/cdcseacave/openMVS.git src

#Make build directory:
mkdir build
cd build

#Run CMake, where VCPKG_ROOT environment variable points to the root of vcpkg installation:
cmake . ..\src -G "Visual Studio 15 2017 Win64" -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DVCG_ROOT="..\VCG"

#Open the solution in MSVC and build it

1.用vcpkg安装并编译外部依赖

VCPKG安装

下载vcpkg库:https://gitee.com/mirrors/vcpkg.git
然后运行::.\vcpkg\bootstrap-vcpkg.bat
运行完之后把vcpkg添加到环境变量即可。

用vcpkg安装包
vcpkg install zlib:x64-windows boost:x64-windows eigen3:x64-windows cgal:x64-windows opencv:x64-windows glew:x64-windows glfw3:x64-windows
下载的包在yourpath/vcpkg/installed中。
运行中可能会提示cmake、boost版本错误需要更新,脚本会自动下载,但可能因为网络问题卡住,比如:
三维重建openMVS-Gpu cuda11.4 win10 vs2019 cmake3.23.1 vcpkg编译安装_第1张图片
download过程中可能像上图一样卡住不动,可以把该步骤链接地址复制下来用freedownload manager去下载,有的包需要,有的不需要,如果超时就试试开启或者关闭工具,最后总能下载好。记得要按照其提示的名字进行重复名并放到vcpkg/downloads目录下,这样脚本才能检测到。下载完之后重新运行安装脚本即可。如果实在没有条件可以私信帮你下载,可能回复有延迟。

如果git出现time out尝试以下命令:
git config --global --unset http.proxy

vcpkg编译python报错:

error: building python3:x64-windows failed with: BUILD_FAILED
Please ensure you‘re using the latest port files with 'git pull' and 'vcpkg update'

三维重建openMVS-Gpu cuda11.4 win10 vs2019 cmake3.23.1 vcpkg编译安装_第2张图片
参考了一篇博客,查看E:\vcpkg-master\ports\python3\portfile.cmake,里面有说明关于win sdk的问题。

# The Windows 11 SDK has a problem that causes it to error on the resource files, so we patch that.
if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP)
    vcpkg_get_windows_sdk(WINSDK_VERSION)
    if("${WINSDK_VERSION}" VERSION_GREATER_EQUAL "10.0.22000")
        list(APPEND PATCHES "0007-workaround-windows-11-sdk-rc-compiler-error.patch")
    endif()
endif()

这里是对win-sdk有限制,需要10.0.22000版本,我尝试过把这个修改成其他版本,但并不行,要求版本的WIN-SDK下载链接如下:WIN-SDK10.0.22000下载链接:https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/

2.cmake部分:

首先要检查cmakelist中OpenMVS_USE_CUDA是否为ON,防止做无用功。
按照官网操作:
cmake . ../src -G "Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE=E:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DVCG_ROOT="../VCG"
报错:
三维重建openMVS-Gpu cuda11.4 win10 vs2019 cmake3.23.1 vcpkg编译安装_第3张图片
看不出来哪里有问题,下面在cmake(版本:3.23.1 April13 release)中进行配置。
配置过程中关键库(CGAL/GMP/MPFR/EIGEN/)报错:
报错a:

CMake Error at libs/MVS/CMakeLists.txt:2 (FIND_PACKAGE):
By not providing "FindCGAL.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file porvided "CGAL", but CMake did not find one.
Could not find a package configuration file provided by "CGAL" with any of the following names:
CGALConfig.cmake
cgal-config.cmake
Add the installation prefix of "CGAL" to CMAKE_PREFIX_PATH or set "CGAL_DIR" to directory conatining one of the above files. If "CGAL" porvides a separate development package or SDK, bu sure it has been installed.

报错b:

CMake Error at E:/ cmake/share/cmake-3.23/Modules/FindPackageHandleStandardAxgs.cmake:230 (message):
could NOT find GMP (missing: GMP_LIBRARIES GMP_INCLUDE_DIR)
call stack (most recent callfirst) :
E:/cmake/share/cmake-3. 23 /Nodules/FindPackageandleStandardArgs.cmake:594 (_FPHSA_FAILORE_MESSAGE)E:/vcpkg/installed/x86-windows/share/cgal/FindGMP .cmake :68 (find_package_handle_standard_args)
E:/vcpkg/installed/x86-windows/share/cgal/CGA_SetupGMP .cmake:24 (find_package)
E:/vapkg/installed/x86-windows/share/cgal/CGAL._SetupCGALDependencies.cmake:36 (include)
E:/vcpkg/installed/x86-windows/share/cga1/cGALConfig.cmake:153 (include)
libs/ Mvs/ CMakeLists.txt: 2(FIND_PACKAGE)

报错c:

CMake Error at E: /cmake/ share/cmake-3.23 /Modules/FindPackageHandleStandardArgs.cmake:230(message):could NOT find MPFR(missing: MPFR_LIBRARIES MPFR_INCLUDE_DIR)
call stack (most recent call first) :
E:/cmake/ share/cmake-3.23/Modules/FindPackageHandleStandardAxgs .cmake:594(_FPHSA_FAILURE_MESSAGE)
E:/vapkq/installed/x86-windows/shaze/ega1/FindMPFR.cmake:52 (find_package_handle_standard_args)
E:/vcpkg/installed/x86-windows/share/cgal/CGAT_SetupGMP . cmake:25 (find_package)
E:/vcpkg/installed/x86-windows/share/cga1/cGAL_SetupCGALDependencies.cmake:36 (include)
E:/vcpkg/installed/x86-windows/share/cga1/CGALConfig.cmake:153 (include)
libs/Mvs/ CMakeLists.txt: 2 (FIND_PACKAGE)

报错d:

CMake Error at E: / cmake/share/cmake-3.23/Modules/FindPackageHiandleStandardArgs .cmake :230(message) :Could NOT find Boost (missing: Boost_INCLUDE_DIR) (found suitable version"1.79.o",minimum required is "1.48")
call stack(most recent call first) :
E:/ cmake/shaze/cmake-3.23/Modules/FindPackageandleStandardArgs .cmake:594 (_FPHSA_FA.ILURE_MESSAGE)
E:/ cmake/share/cmake-3.23/Modules/FindBoost.cmake:2375 (find_package_handle_standard_args)
E:/vcpkg/installed/x86-windows/share/cga1/CGAI_SetupBoost.cmake:20 (find_package)
E: / vcpkg/installed/x86-windows/share/cga1/CGAE_SetupCGALDependencies.cmake:47 (include)
E:/vcpkg/installed/x86-windows/share/cga1/CGALConfig.cmake:153 (include)
E: / vcpkg/installed/x86-windows/share/cga1/CGAE_SetupCGALDependencies.cmake:47 (include)
E:/vcpkg/installed/x86-windows/share/cga1/CGALConfig.cmake:153 (include)

报错e:

CMake Error at E:/cmake/share/cmake-3.23/Nodules/FindPackageand1eStandardAxrgs.cmake:230 (message);
(Required is at least version "2.91.0")
call stack (most recent call first) :
E:/cmake/share/cmake-3.23/Modules/FindPackageHandleStandardAEqs.cmake:594(_FPHSA_FAILURE_MESSAGE)build/Modules/FindEigen3.cmake :97 (find_package_handle_standard_args)
CMakeLists.txt :17s (FIND_PACKAGE)

报错f:

Make Error at E:/cmake/share/cmake-3.23/Modules/FindPackageandleStandardArgs.cmake:230(message) :Could NoT find Boost (missing: Boost_INCLUDE_DIR) (found suitable version"1.79.o", minimum recuired is "1.48")
call stack(most recent call first) :
E:/cmake/share/cmaki-3.23/Modules/FindPackageHandleStandardAxgs . cmake:594 (_FPHSA_FAILURE_MESSAGE)E: /cmake/share/cmake-3.23/Modules/FindBoost.cmake:2375 (find_package_handle_standard_args)
E:/vcpkg/installed/x86-windows/share/cga1/CGAE_SetupBoost.cmake:20 (find_package)
E:/vcpkg/installed/x86-windows/share/cga1/cGAE_setupcGALDependencies.cmake :47 (include)
E :/vapkg/installed/x86-windows/share/cga1/cGALConfig.cmake :153 (include)
libs/MvS/CMakeLists.txt:2 (FIND_PACKAGE)

报错a~f都是因为第三方库路径问题,自行设置目录即可,参考路径如下:

yourpath\vcpkg\installed\x64-windows\include
yourpath\vcpkg\installed\x64-windows\lib
yourpath\vcpkg\installed\x64-windows\debug\lib
yourpath\vcpkg\installed\x64-windows\share
......

配置完成后Boost报错:Could NOT find Boost

CMake Error at E:/cmake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Boost: Found unsuitable version "0.0.0", but required is at
  least "1.48" (found E:/vcpkg/installed/x64-windows/include, )
Call Stack (most recent call first):
  E:/cmake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:592 (_FPHSA_FAILURE_MESSAGE)
  E:/cmake/share/cmake-3.23/Modules/FindBoost.cmake:2375 (find_package_handle_standard_args)
  E:/vcpkg/installed/x64-windows/share/boost/vcpkg-cmake-wrapper.cmake:11 (_find_package)
  E:/vcpkg/scripts/buildsystems/vcpkg.cmake:778 (include)
  E:/vcpkg/installed/x64-windows/share/cgal/CGAL_SetupBoost.cmake:20 (find_package)
  E:/vcpkg/installed/x64-windows/share/cgal/CGAL_SetupCGALDependencies.cmake:47 (include)
  E:/vcpkg/installed/x64-windows/share/cgal/CGALConfig.cmake:153 (include)
  E:/vcpkg/scripts/buildsystems/vcpkg.cmake:824 (_find_package)
  libs/MVS/CMakeLists.txt:2 (FIND_PACKAGE)

报错说找不到Boost,查看报错信息后修改E:\cmake\share\cmake-3.23\Modules\FindBoost.cmake第1827行代码如下:

 file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ")

这里进行修改一下,yourpath/boost/version.hpp,与实际version.hpp目录对应,或者修改cmake变量。

Visual Leak Detector (VLD) is not found.
Using header-only CGAL
Targetting Visual Studio 16 2019
Target build environment supports auto-linking
Using VC toolset 142.
Generator uses intermediate configuration directory: $(Configuration)
Found Boost: E:/vcpkg/installed/x64-windows/include (found suitable version "1.79.0", minimum required is "1.48")  
Boost include dirs: E:/vcpkg/installed/x64-windows/include
Boost libraries:    
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE  
VCG  found (include: E:/openMVS/VCG)
GLEW  found (include: E:/vcpkg/installed/x64-windows/include)
GLFW3 3.3.7 found (include: )
Configuring done
Generating done

configure成功。

项目生成(存在问题,但后续步骤已解决)
打开OpenMVS.sln
将app/Viewer设为启动项生成

报错1:
三维重建openMVS-Gpu cuda11.4 win10 vs2019 cmake3.23.1 vcpkg编译安装_第4张图片

严重性代码说明项目文件行禁止显示状态错误 LNK1181 无法打开输入文件““..\..\lib\vc16\x64\Release\MVS.lib”	Viewer	E:\openMVS-develop\build\apps\Viewer\LINK 1	

在相应位置也没有找到MVS.lib,而只有common.lib\math.lib\io.lib。因此尝试先生成MVS,选择MVS为启动项然后生成,报错如下
报错2:
三维重建openMVS-Gpu cuda11.4 win10 vs2019 cmake3.23.1 vcpkg编译安装_第5张图片

Internal Compiler Error (codegen):"unexpected operand in tex/surf handler"
严重性代码说明项目文件行禁止显示状态错误	Internal Compiler Error (codegen): "unexpected operand in tex/surf handler" MVS C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include\texture_indirect_functions.h	149	
严重性代码说明项目文件行禁止显示状态错误 MSB3721 命令“"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\bin\nvcc.exe" -gencode=arch=compute_50,code=\"compute_50,compute_50\" -gencode=arch=compute_50,code=\"sm_50,compute_50\" -gencode=arch=compute_72,code=\"compute_72,compute_72\" -gencode=arch=compute_72,code=\"sm_72,compute_72\" -gencode=arch=compute_75,code=\"compute_75,compute_75\" -gencode=arch=compute_75,code=\"sm_75,compute_75\" --use-local-env -ccbin "F:\vs\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64" -x cu   -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include" -I"E:\vcpkg\installed\x64-windows\include\eigen3" -I"E:\openMVS-develop\src" -I"E:\openMVS-develop\build" -I"E:\openMVS-develop\VCG" -I"E:\vcpkg\installed\x64-windows\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include"     --keep-dir x64\Release  -maxrregcount=0  --machine 64 --compile -cudart static --expt-relaxed-constexpr -std=c++17 -Xcompiler="/EHsc -Ob2"   -D_WINDOWS -DNDEBUG -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_LIB -D_USE_OPENMP -D_USE_OPENGL -D_USE_CUDA -D_USE_BOOST -D_USE_EIGEN -D_USE_NONFREE -D_USE_FAST_FLOAT2INT -D_USE_FAST_CBRT -D_USE_SSE -DCGAL_USE_GMPXX=1 -D"CMAKE_INTDIR=\"Release\"" -D_MBCS -DWIN32 -D_WINDOWS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -DNDEBUG -D_SCL_SECURE_NO_DEPRECATE -D_LIB -D_USE_OPENMP -D_USE_OPENGL -D_USE_CUDA -D_USE_BOOST -D_USE_EIGEN -D_USE_NONFREE -D_USE_FAST_FLOAT2INT -D_USE_FAST_CBRT -D_USE_SSE -DCGAL_USE_GMPXX=1 -D"CMAKE_INTDIR=\"Release\"" -Xcompiler "/EHsc /W3 /nologo /O2 /FdE:\openMVS-develop\build\lib\vc16\x64\Release\MVS.pdb /FS   /MD /GR" -o MVS.dir\Release\/PatchMatchCUDA.cu.obj "E:\openMVS-develop\src\libs\MVS\PatchMatchCUDA.cu"”已退出,返回代码为 2。	MVS	F:\vs\MSBuild\Microsoft\VC\v160\BuildCustomizations\CUDA 11.3.targets	785	

解决cuda相关问题:这里看到cuda官网给出的一段解释是这是cuda11.3存在bug,已经在后续的版本进行了修正,如果你在一开始就用cuda11.4那么应该不存在此问题,可以跳过。
在解决cuda报错后重新生成MVS,仍然存在报错,说明在cmake步骤存在问题。仔细看一下cmake中输出的信息,里面有一段关于MVS的warning:

-- Found Boost: E:/vcpkg/installed/x64-windows/include (found version "1.79.0") found components: iostreams program_options system serialization regex
-- Found Eigen3: E:/vcpkg/installed/x64-windows/include/eigen3 (Required is at least version "2.91.0")
-- Eigen 3.4.0 found (include: E:/vcpkg/installed/x64-windows/include/eigen3)
-- Found OpenCV: E:/vcpkg/installed/x64-windows (found version "4.5.5")
-- OpenCV 4.5.5 found (include: E:/vcpkg/installed/x64-windows/include)
CMake Warning at E:/vcpkg/installed/x64-windows/share/cgal/CGALConfig.cmake:92 (message):
  CGAL_DATA_DIR cannot be deduced, set the variable CGAL_DATA_DIR to set the
  default value of CGAL::data_file_path()
Call Stack (most recent call first):
  E:/vcpkg/scripts/buildsystems/vcpkg.cmake:824 (_find_package)
  libs/MVS/CMakeLists.txt:2 (FIND_PACKAGE)

这里虽然是警告,但会导致MVS.lib生成出现问题,下面在cmake中查找问题。

CMake Error at CMakeLists.txt:188 (FIND_PACKAGE):
  By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "OpenCV", but
  CMake did not find one.

  Could not find a package configuration file provided by "OpenCV" with any
  of the following names:

    OpenCVConfig.cmake
    opencv-config.cmake

  Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
  "OpenCV_DIR" to a directory containing one of the above files.  If "OpenCV"
  provides a separate development package or SDK, be sure it has been
  installed.

configure Opencv报错,参考路径:yourpath/vcpkg/installed/x64-windows/share/opencv

CMake Error at libs/MVS/CMakeLists.txt:2 (FIND_PACKAGE):
  By not providing "FindCGAL.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "CGAL", but
  CMake did not find one.

  Could not find a package configuration file provided by "CGAL" with any of
  the following names:

    CGALConfig.cmake
    cgal-config.cmake

  Add the installation prefix of "CGAL" to CMAKE_PREFIX_PATH or set
  "CGAL_DIR" to a directory containing one of the above files.  If "CGAL"
  provides a separate development package or SDK, be sure it has been
  installed.

configure CGAL报错,参考路径:yourpath\vcpkg\installed\x64-windows\share\cgal

CMake Error at E:/cmake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find GMP (missing: GMP_LIBRARIES GMP_INCLUDE_DIR)
Call Stack (most recent call first):
  E:/cmake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  E:/vcpkg/installed/x64-windows/share/cgal/FindGMP.cmake:68 (find_package_handle_standard_args)
  E:/vcpkg/installed/x64-windows/share/cgal/CGAL_SetupGMP.cmake:24 (find_package)
  E:/vcpkg/installed/x64-windows/share/cgal/CGAL_SetupCGALDependencies.cmake:36 (include)
  E:/vcpkg/installed/x64-windows/share/cgal/CGALConfig.cmake:153 (include)
  libs/MVS/CMakeLists.txt:2 (FIND_PACKAGE)

configure GMP报错,参考路径:E:/vcpkg/installed/x64-windows/share/gmp E:/vcpkg/installed/x64-windows/lib/gmp.lib
mfpr会有相同的问题,方法类似配置路径即可。

CMake Error at E:/cmake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Boost (missing: Boost_INCLUDE_DIR) (found suitable version
  "1.79.0", minimum required is "1.48")
Call Stack (most recent call first):
  E:/cmake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  E:/cmake/share/cmake-3.23/Modules/FindBoost.cmake:2375 (find_package_handle_standard_args)
  E:/vcpkg/installed/x64-windows/share/cgal/CGAL_SetupBoost.cmake:20 (find_package)
  E:/vcpkg/installed/x64-windows/share/cgal/CGAL_SetupCGALDependencies.cmake:47 (include)
  E:/vcpkg/installed/x64-windows/share/cgal/CGALConfig.cmake:153 (include)
  libs/MVS/CMakeLists.txt:2 (FIND_PACKAGE)

这里报错说找不到Boost_INCLUDE_DIR,修改Boost_INCLUDE_DIR后正常,但报错提示找不到iostream、program_options、system、serialization

CMake Error at E:/cmake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Boost (missing: iostreams program_options system
  serialization) (found version "1.77.0")
Call Stack (most recent call first):
  E:/cmake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  E:/cmake/share/cmake-3.23/Modules/FindBoost.cmake:2375 (find_package_handle_standard_args)
  CMakeLists.txt:168 (FIND_PACKAGE)

这里在cmake中修改相应的库路径后依然无法解决。开始怀疑是不是boost和cmake的版本问题导致的cmake检索不到。因此长袖修改boost版本。事实证明并不是版本问题,所作操作如下。

================================================================

问题步骤,更改boost版本这一步,在后面步骤中发现此该步无效,就当学习了
cmake需要用boost发布版本之后的,这里3.23时april13 boost1.79也是april13,因此将boost改成了1.78版本,这里给出一个下载地址:
Boost下载地址:https://boostorg.jfrog.io/ui/native/main/release/1.68.0/source/
下载完之后使用vs2019进行编译,编译过程参考:Boost编译教程:https://blog.csdn.net/fenghaiyang198848/article/details/120017165
这里再简单记录一下:
1.运行Developer Command Prompt for VS 2019;
2.进入解压目录;
3.bootstrap msvc;
4.编译并安装b2 install --build-type=complete threading=multi link=shared address-model=64 toolset=msvc-16.0
5.编译完成后自动存放在C:\Boost。
msvc版本对应关系如下,推荐msvc2019,如果不一样可能需要下载不同版本的包:

VC版本 VS版本 MSVC版本
VC14.0 VS2015 v130
VC15.0 VS2017 v141
VC16.0 VS2019 v142
VC17.0 VS2022 v143

下载完后在cmake中配置boost的include和library路径,依然有同样的错误。

CMake Error at E:/cmake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Boost (missing: iostreams program_options system
  serialization) (found version "1.77.0")
Call Stack (most recent call first):
  E:/cmake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  E:/cmake/share/cmake-3.23/Modules/FindBoost.cmake:2375 (find_package_handle_standard_args)
  CMakeLists.txt:168 (FIND_PACKAGE)

================================================================

问题解决:在Cmake中选中Boost_Debug可以输出cmake在查询lib时的所用路径信息,发现其搜索路径不匹配。因此需要添加变量BOOST_LIBRARYDIR,到你的lib路径,进去之后要看搜索名字与你的实际lib名字是否对应,并做相应修改。
可能会提示GLEW、GLFW3未找到并continuing without it,这里最好不要让他跳过,在cmake中选择好vcpkg下载后的对应路径继续configure、generate。

3.OpenMVS在vs2019中生成可执行文件:

用vs2019打开OpenMVS.sln,将MVS设为启动项进行生成。生成成功后,把app中的DensifyPointCloudInterfaceCOLMAP依次生成为可执行程序。
sln在生成app过程中中报错:
错误1

LNK1104 无法打开文件“libboost_serialization-vc142-mt-gd-x32-1_74.lib” DensifyPointCloud	

类似的错误可以通过修改lib文件名解决。
错误2

严重性代码说明项目文件行禁止显示状态错误 LNK1104 无法打开文件“libboost_zlib-vc142-mt-x64-1_77.lib”	DensifyPointCloud	E:\openMVS-develop\build\apps\DensifyPointCloud\LINK	1

该错误无论怎么修改文件名和配置路径都无效,可能因为zlib是在vcpkg中自动编译的,boost是自己用msvc2019编译的,所以可能是在编译过程中某些参数不对所以存在版本不匹配的问题,这里又切回了原来vcpkg下载的boost,配置过程相同,重新configure、generate成功,再重新打开OpenMVS.sln进行生成。

总结步骤如下:

1.mkdir openmvs cd openmvs
2.Github下载OpenMVS-develop:[https://github.com/cdcseacave/openMVS/tree/develop](https://github.com/cdcseacave/openMVS/tree/develop)
建议下载OpenMVS-develop,该版本是持续更新的一版,减少出错可能,因为里边有外部依赖项,下载龟速,这里提供百度云链接:百度云链接:https://pan.baidu.com/s/1KVwT1ZPpxq-8V8zTQ72Btw,提取码:39hc
3.用vcpkg编译依赖包
vcpkg install zlib:x64-windows boost:x64-windows eigen3:x64-windows cgal:x64-windows opencv:x64-windows glew:x64-windows glfw3:x64-windows
安装过程中的问题看上面的描述
4.下载VCG
git clone https://github.com/cdcseacave/VCG.git
5.cmake
添加变量BOOST_LIBRARYDIR = yourpath/vcpkg/installed/x64-windows/lib,如果有其他依赖项需要配置,参考上面的过程进行confgure。
6.生成可执行文件
用vs2019打开OpenMVS.sln,以MVS为启动项生成lib,然后按照需求依次生成app中的项目(DensifyPointCloud、InterfaceCOLMAP、InterfaceMetashape、ReconstructMesh、RefineMesh、TextureMesh、Viewer)即可。

存在少部分报错信息忘记截图,但所遇到的关键要解决的问题已经总结如上。

你可能感兴趣的:(三维重建,OpenMVS,计算机视觉,visual,studio,windows,opencv)