openmvg, colmap windows10 compilation experience document

Because of the company's business development needs, it is necessary to switch from linux to windows, which means that people who have not used windows for about 4 years need to port the code on linux to windows. The following are some workflows for compiling colmap and openmvg on windows.

Colmap cross-platform porting (combination of vcpkg and cmake)

1. Libraries that need to be installed manually

insert image description here

insert image description here

The purpose of D:\vs2019\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x64 is to configure cl.exe

insert image description here

The effect of cmake find Qt is as follows:

insert image description here

  • Install nvidia driver and cudn

Query the driver according to your own graphics card https://www.nvidia.cn/geforce/drivers/ , your computer is 1660ti after installing the driver, nvidia-smi can see the following effect:

insert image description here

The cudn installation method is like https://blog.csdn.net/u010618587/article/details/82940528 , do not install the family bucket, otherwise the previous driver will be covered. After the installation is complete, add environment variables according to the blog method and test whether cudn is running normally Success, and finally enter nvcc -V on the command line, as shown below to indicate the end of the installation:

insert image description here

  • cgal installation download link cgal

     添加环境变量如下:
    

insert image description here

2. Libraries installed through vcpkg

git clone https://github.com/microsoft/vcpkg
cd vcpkg
./bootstrap-vcpkg.sh
  • ceres solver, if it is installed manually, it is very troublesome, so here it is installed by vcpkg
vcpkg install ceres[suitesparse,cxsparse]:x64-windows --recurse

At the same time, modify CeresConfig.cmake under the vcpkg-master\packages\ceres_x64-windows\share\ceres path and change it to the following (otherwise cmake cannot find ceres)

insert image description here

  • vcpkg installs freeimage, glew and boost as follows:

insert image description here

After the installation here, you need to modify the CmakeLists of colmap, as follows: (windows is too pitted, case-sensitive)

insert image description here

3. cmake compiles colmap

Enter the build folder and enter

cmake -G "Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE=D:\windows_colmap\colmap\vcpkg-master\scripts\buildsystems\vcpkg.cmake ..

The cmake log is as follows:

insert image description here

There is no error in cmake. The last step is to open the COLMAP.sln file in the build folder, change the mode to release, and wait for the build solution to compile. After completion, it is as follows (colmap.exe is in the build\src\exe\Release directory) :

insert image description here

openmvg cross-platform porting

  • vcpkg install openmvg[core,openmp]:x64-windows

       遇到长时间不能下载的库,手动下载,放到vcpkg 文件夹中的download 里面
      
       vcpkg 安装openmvg 和colmap 不同,colmap 会直接编译好生成可执行文件;openmvg只会生成静态库文件(lib文件)
    
  • cmake -G "Visual Studio 16 2019" - DCMAKE_TOOLCHAIN_FILE=D:\windows_colmap\colmap\vcpkg-master\scripts\buildsystems\vcpkg.cmake ../src/

     在build 文件中执行上条cmake,会得到以下:
    

insert image description here

     点击openMVG.sln 文件,打开vs2019,将debug 改成release ,执行build solution ,如下

insert image description here

The generated executable file paths and results are as follows:

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-AkhSdLCD-1612342899028) (C:\Users\yuanc\Desktop\cross-platform compilation\openmvg\static_8Bq3T76vUAw6xBKeh2Ahpk_3.png) ]

Guess you like

Origin blog.csdn.net/qq_15642411/article/details/113614940