工具:
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
參考:
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獲取爲這個值)