一. 依赖文件的安装
Vs Code 与Visual Studio 两个程序各有千秋,配置OpenCv 的方式也就不一样了。
本文以 Vs Code 为主,前期准备工作要准备好:
· Cmake 下载 官网如下:
CMake - Upgrade Your Software Build System
· MinGw 下载官网如下:
MinGW-w64 - for 32 and 64 bit Windows - Browse Files at SourceForge.net
· Vs Code 下载以及C++的配置,根据自己的系统选择,Vs Code 官网如下:
Visual Studio Code - Code Editing. Redefined
· Opencv下载,版本更新迭代很快,选择你喜欢的版本(根据你的电脑系统)下载,官网如下:
OpenCV - Open Computer Vision Library
二. Cmake编译
code无法直接使用opencv,需要把opencv的源文件进行编译,然后才能使用,这里借助CMake 编译
2-1. cmake需要注意的是
Where is the source code : 源码目录,我们使用opencv目录下的source=目录
Where to build the binaries : 最终输出构建的目录 放到opencv/build/x64/mingw
2-2. 点击Configure
Specify 他和generator for this project :指定此项目的生成器
Optional platform for generator(if empty,generator uses: x64): 生成器的可选平台(空,使用x64)
Optional toolset to use (argument to -T): 要使用的可选工具集
Use default native compilers : 使用默认编译
Specify native compilers: 指定本机编译
Specity toolchain file for cross-compiling :指定用于交编译的工具链文件
Specify options for cross-compiling: 指定交互编译的选项
2-3. 选择MinGw Makefile ,点击next
2-4. 选