windows7 VS2017 x64 编译OpenMVG和OpenMVS记录

参考博客:https://blog.csdn.net/mitsubishisony/article/details/52332470?utm_source=blogxgwz1

简单记录在编译过程中的步骤和遇到的问题:

平台:windows7 VS2017 x64

1、OpenMVG的编译:

  • VS2017安装,注意没有证书问题
  • 代码下载,速度慢。可以到码云上构建仓库下载,但是还需要手动下载几个依赖库
  • cmake-3.17.3-win64-x64(或是低版本3.9.3),注意Cmake版本不对也可能出现“NO CMKE_C_COMPILER”错误
  • 如果选择了生成"Example",就需要编译ceres-1.13.0库(eigen3.2.4,glog0.3.5,gflags2.2.2,suitesparse1.5.0),并添加,否则会提示缺少"ceres.lib"
  • 需要QT5.12.3库(可选)
  • 需要opencv 库,3.1.0就行,vs2013编译的都可以
  • LinkC1001错误,优化方式不一样,禁用VS2017内部的优化,C/C++/优化
  • 编译结束后,生成的openMVG_jpeg.lib需要提供给OpenMVS使用,不然没法数据转换

2、OpenMVS的编译:

  • CUDA10.0的安装(可选,建议安装)
  • vcpkg直接安装库,没有成功,因此还是自己编译了依赖库,包括:CGAL-5.0,glew-2.1.0,glfw-3.3,vcg1.0.1,zlib1.2.10,boost1.65.1
  • boost 编译:执行boost文件下的bootstrap.bat;用VS2017工具下以管理员方式打开命令窗口:x64 Native Tools Command Prompt for VS 2017;然后安装需要的库:bjam stage --toolset=msvc-14.1 --with-iostreams --with-system --with-thread --with-program_options --with-serialization --with-date_time -sZLIB_SOURCE="D:\build\3rdparty\zlib-1.2.10" -sZLIB_INCLUDE="D:\build\3rdparty\zlib-1.2.10" --stagedir="C:\Program Files\Boost\lib" address-model=64 link=static runtime-link=shared threading=multi debug release
  • 注意boost编译需要同时生成静态库和共享库,link=static/link=shared,共享库用于cmake编译,静态库用于VS2017编译,不然可能会报boost相关错误
  • camke编译时不能勾选生成共享库,不然编译会报错
  • 这种错误“CMake Error: install(EXPORT "OpenMVSTargets" ...) includes target "MVS" which requires target "CGAL" that is not in the export set”可以不用管,编译时在MVS工程下手动添加头文件和库文件也可以

  • 重建时的”f“参数记得修改为1.2*max(width,height)
  • 把“CGAL\auxiliary\gmp\lib”路径下的两个.dll文件放到需要运行的.exe路径文件下。

3、重建:

参考官方步骤:https://openmvg.readthedocs.io/en/latest/software/SfM/SfM/

或是:https://blog.csdn.net/qq_42615787/article/details/105609338

OpenMVG例子:

install\bin\openMVG_main_SfMInit_ImageListing.exe -i dataset -o dataset_output/matches -f 3225.6

install\bin\openMVG_main_ComputeFeatures.exe -i dataset_output/matches/sfm_data.json -o dataset_output/matches

install\bin\openMVG_main_ComputeMatches.exe -i dataset_output/matches/sfm_data.json -o dataset_output/matches

install\bin\openMVG_main_IncrementalSfM.exe -i dataset_output/matches/sfm_data.json -m dataset_output\matches\ -o dataset_output/out_Incremental_Reconstruction 

install\bin\openMVG_main_ExportUndistortedImages.exe -i dataset_output/matches/sfm_data.json -o dataset_output/out_Incremental_Reconstruction/undistortedimage

install\bin\openMVG_main_openMVG2openMVS.exe -i dataset_output/out_Incremental_Reconstruction/sfm_data.bin -o dataset_output/out_Incremental_Reconstruction/scene.mvs 

OpenMVS例子(记得先复制数据):

DensifyPointCloud.exe out_Incremental_Reconstruction\scene.mvs

ReconstructMesh.exe out_Incremental_Reconstruction\scene_dense.mvs

RefineMesh.exe out_Incremental_Reconstruction\scene_dense_mesh.mvs

TextureMesh.exe out_Incremental_Reconstruction\scene_dense_mesh_refine.mvs

 

你可能感兴趣的:(SLAM)