工具:
vcpkg-2020.04
Error: Building package opengl:x64-windows failed with: BUILD_FAILED
如题:
解决方案:
https://github.com/microsoft/vcpkg/issues/9145
打开自己电脑的:C:\Program Files (x86)\Windows Kits
发现我的只有8.1里面才有OpenGL32.Lib GlU32.Lib
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64
打开:
~\vcpkg-2020.04\ports\opengl\portfile.cmake
修改:
直接指定:
#vcpkg_get_windows_sdk(WINDOWS_SDK)
set(WINDOWS_SDK "8.1")
还安装opencv的额外第三方库出现错误
-- Using cached D:/code/SFM/vcpkg-2020.04/downloads/opencv-opencv-4.1.1.tar.gz
-- Using source at D:/code/SFM/vcpkg-2020.04/buildtrees/opencv4/src/4.1.1-fb9e10326a
-- Using cached D:/code/SFM/vcpkg-2020.04/downloads/opencv-cache/tiny_dnn/adb1c512e09ca2c7a6faef36f9c53e59-v1.0.0a3.tar.gz
-- Using cached D:/code/SFM/vcpkg-2020.04/downloads/opencv-opencv_contrib-4.1.1.tar.gz
-- Using source at D:/code/SFM/vcpkg-2020.04/buildtrees/opencv4/src/4.1.1-521dd00bd2
-- Downloading https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm.i...
-- Downloading https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm.i... Failed. Status: 6;"Couldn't resolve host name"
CMake Error at scripts/cmake/vcpkg_download_distfile.cmake:175 (message):
Failed to download file.
If you use a proxy, please set the HTTPS_PROXY and HTTP_PROXY environment
variables to "https://user:password@your-proxy-ip-address:port/".
Otherwise, please submit an issue at https://github.com/Microsoft/vcpkg/issues
Call Stack (most recent call first):
ports/opencv4/portfile.cmake:110 (vcpkg_download_distfile)
scripts/ports.cmake:90 (include)
Error: Building package opencv4:x64-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
Package: opencv4:x64-windows
Vcpkg version: 2020.02.04-nohash
参考:
https://github.com/microsoft/vcpkg/issues/10199
下载:
https://github.com/opencv/opencv_3rdparty/tree/contrib_xfeatures2d_boostdesc_20161012
https://github.com/opencv/opencv_3rdparty/tree/contrib_xfeatures2d_vgg_20160317
https://github.com/opencv/opencv_3rdparty/tree/contrib_face_alignment_20170818
下载好,名字改成:
vcpkg-2020.04\ports\opencv4\portfile.cmake 对应文件名
如:
集成到VS2015
如果不想整体集成,使用工程化集成,请看博客:
https://www.cnblogs.com/flyinggod/p/10786243.html
参考:
https://github.com/openMVG/openMVG/blob/develop/BUILD.md#using-openmvg-as-a-third-party-library-dependency-with-cmake
vcpkg-2020.04 对应使用是下面版本的MVG
git clone --recursive https://github.com/openMVG/openMVG.git
git checkout 606d1c9e82123dd50de282128151a50bf42262fc
如果想通过cmakelist使用:
在cmakelist中加入上述可使用openmvg的库,然后通过cmake-gui界面编译
The package openmvg:x64-windows provides CMake targets:
find_package(OpenMVG CONFIG REQUIRED)
# Note: 17 target(s) were omitted.
target_link_libraries(main PRIVATE OpenMVG::vlsift OpenMVG::openMVG_sfm OpenMVG::openMVG_exif OpenMVG::openMVG_fast)
也可以这样:
参考我之前的博客:
https://blog.csdn.net/baidu_40840693/article/details/84754035
像ubuntu一样,使用命令包含整体的vcpkg库
git clone --recursive https://github.com/openMVG/openMVG.git
cd openMVG
cd src
新建build (如果没装qt,记得把src中cmakelist的qt选项注释下,具体看博客上面说的那个)
cd build
在Powershell中输入以下命令(确保你之前安装了CMAKE,并加入了path环境变量)
cmake . ..\ -G "Visual Studio 14 2015 Win64" -DCMAKE_TOOLCHAIN_FILE=D:\code\SFM\vcpkg-2020.04\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows
打开build
编译Debug 和 Release
关于MVG中的焦距计算公式顺便提一下:
jpg中的信息是:
sensor_width_camera_database.txt中的信息是:
Kodak EasyShare Z612;5.75
最后:
focal = std::max ( width, height ) * exifReader->getFocal() / ccdw;
其中ccdw=5.75 exifReader->getFocal()=5.8499 (图中所示的6毫米,但实际通过exif获取为这个值)