openmvg的安装过程

参考:openMVG/BUILD.md

准备工作

需要安装Visual Studio 2022

安装CMake 3.30.9

安装Graphviz 要选中添加到环境变量

安装vcpkg

在D盘根目录

1
2
3
4
5
6
git clone https://github.com/Microsoft/vcpkg
cd vcpkg
./bootstrap-vcpkg.bat

.\vcpkg.exe install openmvg[core,openmp,opencv]

编译openMVG

同样在D盘根目录

1
git clone --recursive https://github.com/openMVG/openMVG.git

打开D:\openMVG\src\CMakeLists.txt

找到option(OpenMVG_USE_RERUN "Enable Rerun logging" ON)修改为option(OpenMVG_USE_RERUN "Enable Rerun logging" OFF)

然后继续在D盘根目录

1
2
3
mkdir openMVG_Build
cd openMVG_Build
cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_TOOLCHAIN_FILE=D:/vcpkg/scripts/buildsystems/vcpkg.cmake -DOPENMVG_USE_RERUN=OFF -DEIGEN_INCLUDE_DIR_HINTS="D:/vcpkg/installed/x64-windows/include" ../openMVG/src/

完成后,使用visual studio 2022打开openMVG_Build目录下的openMVG.sln点菜单中的生成->生成解决方案

等生成完成后,会在目录下生成一个Windows-AMD64-,至此编译完成,可以将此目录添加到环境变量中。

使用

将拍摄的照片放到D:\imgs中,输出到D:\imgsout

1
2
3
4
5
6
7
8
9
10
11
12
13
14
openMVG_main_SfMInit_ImageListing.exe -i D:\imgs -o D:\imgsout -f 4838 sfm_data.json

openMVG_main_ComputeFeatures.exe -i D:\imgsout\sfm_data.json -o D:\imgsout

openMVG_main_ComputeMatches.exe -i D:\imgsout\sfm_data.json -o D:\imgsout\matches.putatives.bin

openMVG_main_GeometricFilter.exe -i D:\imgsout\sfm_data.json -m D:\imgsout\matches.putatives.bin -g f -o D:\imgsout\matches.f.bin

openMVG_main_SfM.exe --sfm_engine "INCREMENTAL" -i D:\imgsout\sfm_data.json -m D:\imgsout -o D:\imgsout\regconstruction

openMVG_main_ExportUndistortedImages.exe -i D:\imgsout\sfm_data.json -o D:\imgsout\regconstruction\undistortedimage

CD D:\imgsout\regconstruction
openMVG_main_openMVG2openMVS.exe -i sfm_data.bin -o scene.mvs

然后打开ui_openMVG_MatchesViewer.exe,File中选择sfm_data.json,再选择matches.putatives.bin就可以查看了。

下载Releases · cdcseacave/openMVS 解压后,将上面生成的D:\imgsout\regconstruction\scene.ms拖到Viewer.exe上可以查看生成的3D模型。


openmvg的安装过程
https://oujun.work/2025/11/17/openmvg的安装过程.html
作者
欧俊
发布于
2025年11月18日
许可协议