opencv-contrib编译-win10+vs2019环境

材料

  • opencv文件
    https://opencv.org
  • opencv-contrib
    https://github.com/opencv/opencv_contrib/releases
  • 编译工具:cmake(一路默认安装就行)
  • https://cmake.org/download/

注意事项:

  • contrib文件的版本号一定要与opencv的版本号对应 。
  • cmake最好下载最新版本,我之前用的3.111是不支持vs2019的,会导致下面出错。

解压,创建输入文件夹

下载下来的opencv安装包应该是一个exe文件,而contrib是一个压缩包
opencv-contrib编译-win10+vs2019环境_第1张图片opencv-contrib编译-win10+vs2019环境_第2张图片
输出文件夹:你要保存编译结果的文件夹,个人建议把三个东西都放在一个大文件夹上,如下图:
opencv-contrib编译-win10+vs2019环境_第3张图片

开始编译

step1 :输入1号框的内容,然后按2号框处的configure

opencv-contrib编译-win10+vs2019环境_第4张图片

step2:配置opencv-contrib的地址

opencv-contrib编译-win10+vs2019环境_第5张图片
注意事项:想要使用SURF,SIFT算法的,一定要把OPENCV_ENABLE_NONFREE这一选项勾上!

生成解决方案

step1: 找到你cmake输出的文件夹,打开opencv.sln

opencv-contrib编译-win10+vs2019环境_第6张图片

step2:右键重新生成解决方案

opencv-contrib编译-win10+vs2019环境_第7张图片

step3: 找到CMakeTargets中的INSTALL,然后右键选择“仅限于项目”–>“仅生成INSTALL”

配置项目文件:

VC++目录–>包含目录,添加:
D:\opencv3\opencv\mybuild\install\include

VC++目录–>库目录,添加:
D:\opencv3\opencv\mybuild\install\x86\vc12\lib
D:\opencv3\opencv\mybuild\install\x86\vc12\staticlib

链接器–>输入–>附加依赖项,添加:

opencv_aruco347d.lib
opencv_bgsegm347d.lib
opencv_calib3d347d.lib
opencv_ccalib347d.lib
opencv_core347d.lib
opencv_datasets347d.lib
opencv_dnn347d.lib
opencv_dpm347d.lib
opencv_face347d.lib
opencv_features2d347d.lib
opencv_flann347d.lib
opencv_fuzzy347d.lib
opencv_hdf347d.lib
opencv_highgui347d.lib
opencv_imgcodecs347d.lib
opencv_imgproc347d.lib
opencv_line_descriptor347d.lib
opencv_ml347d.lib
opencv_objdetect347d.lib
opencv_optflow347d.lib
opencv_photo347d.lib
opencv_plot347d.lib
opencv_reg347d.lib
opencv_rgbd347d.lib
opencv_saliency347d.lib
opencv_shape347d.lib
opencv_stereo347d.lib
opencv_stitching347d.lib
opencv_structured_light347d.lib
opencv_superres347d.lib
opencv_surface_matching347d.lib
opencv_text347d.lib
opencv_tracking347d.lib
opencv_video347d.lib
opencv_videoio347d.lib
opencv_videostab347d.lib
opencv_xfeatures2d347d.lib
opencv_ximgproc347d.lib
opencv_xobjdetect347d.lib
opencv_xphoto347d.lib

参考博客

https://blog.csdn.net/ezhchai/article/details/80557936
https://www.cnblogs.com/jliangqiu2016/p/5597501.html

你可能感兴趣的:(Opencv学习)