CMake OpenCV4.2 SFM模块(Windows 10, VS2017)

    环境:Win10, OpenCV4.2,VS2017, CMake 3.9.1

    参考链接:https://blog.csdn.net/fanhao900322/article/details/78787712

                     https://blog.csdn.net/wzheng92/article/details/79504709 

    ① GFlags编译,源码链接:https://github.com/gflags/gflags/tree/v2.2.2

CMake OpenCV4.2 SFM模块(Windows 10, VS2017)_第1张图片

 

 

 

ALL_Build之后,Install仅用于项目生成,生成文件目录如下:

C:/Program Files/gflags/lib/gflags_static.lib
C:/Program Files/gflags/lib/gflags_nothreads_static.lib
C:/Program Files/gflags/include/gflags/gflags.h
C:/Program Files/gflags/include/gflags/gflags_declare.h
C:/Program Files/gflags/include/gflags/gflags_completions.h
C:/Program Files/gflags/include/gflags/gflags_gflags.h
C:/Program Files/gflags/lib/cmake/gflags/gflags-config.cmake
C:/Program Files/gflags/lib/cmake/gflags/gflags-config-version.cmake
C:/Program Files/gflags/lib/cmake/gflags/gflags-targets.cmake
C:/Program Files/gflags/lib/cmake/gflags/gflags-targets-release.cmake
C:/Program Files/gflags/lib/cmake/gflags/gflags-nonamespace-targets.cmake
C:/Program Files/gflags/lib/cmake/gflags/gflags-nonamespace-targets-release.cmake

    ② glog编译:源码链接:https://github.com/google/glog/tree/v0.4.0

    需要依赖上一步生成的GFlags Install目录,然后同样VS2017生成,Install生成文件目录:

CMake OpenCV4.2 SFM模块(Windows 10, VS2017)_第2张图片

C:/Program Files/glog/lib/glog.lib
C:/Program Files/glog/include/glog/logging.h
C:/Program Files/glog/include/glog/raw_logging.h
C:/Program Files/glog/include/glog/stl_logging.h
C:/Program Files/glog/include/glog/vlog_is_on.h
C:/Program Files/glog/include/glog/log_severity.h
C:/Program Files/glog/lib/cmake/glog/glog-config.cmake
C:/Program Files/glog/lib/cmake/glog/glog-config-version.cmake
C:/Program Files/glog/lib/cmake/glog/glog-targets.cmake
C:/Program Files/glog/lib/cmake/glog/glog-targets-release.cmake

    ③ Eigen3.3.7编译,源码链接:https://gitlab.com/libeigen/eigen/-/releases

ALL_Build之后,Install仅用于项目生成,生成文件目录C:/Program Files/Eigen3/include/eigen3...

    ④ Suitesparse编译,源码链接:https://github.com/jlblancoc/suitesparse-metis-for-windows/tree/v1.5.0

CMake OpenCV4.2 SFM模块(Windows 10, VS2017)_第3张图片

CMake OpenCV4.2 SFM模块(Windows 10, VS2017)_第4张图片

CMake OpenCV4.2 SFM模块(Windows 10, VS2017)_第5张图片

CMake OpenCV4.2 SFM模块(Windows 10, VS2017)_第6张图片

    ⑤ Ceres-solver编译,链接https://ceres-solver.googlesource.com/ceres-solver/+/refs/tags/1.13.0

        点击【tgz】下载,下载后需要解压两层才能获得Ceres源代码

    ⑥ OpenCV编译,需要配置前面几个路径,可以参考以下三个链接,相信你可以搞定了

         https://blog.csdn.net/wzheng92/article/details/79504709

         https://www.jianshu.com/p/89a5705f0941    

         https://blog.csdn.net/fanhao900322/article/details/78787712

     CMake OpenCV4.2 SFM模块(Windows 10, VS2017)_第7张图片

CMake OpenCV4.2 SFM模块(Windows 10, VS2017)_第8张图片

    使用的时候注意添加opencv_sfm420.lib

CMake OpenCV4.2 SFM模块(Windows 10, VS2017)_第9张图片

    还可能会遇到一个问题,就是提示reconstruct函数无法识别的标识符,解决方法在#include

添加#define CERES_FOUND 1

    接下来运行一个实例,代码见官方文档https://docs.opencv.org/master/d4/d18/tutorial_sfm_scene_reconstruction.html

注意运行时将前面生成的dll都复制过来或者加到环境变量(推荐)

CMake OpenCV4.2 SFM模块(Windows 10, VS2017)_第10张图片

CMake OpenCV4.2 SFM模块(Windows 10, VS2017)_第11张图片

运行生成的点云感觉很稀疏,和官方结果不一样,需要再研究研究问题在哪

CMake OpenCV4.2 SFM模块(Windows 10, VS2017)_第12张图片

你可能感兴趣的:(OpenCV)