正常流程是MinGW+CMake+opencv编译,可以参考以下教程:
OpenCV使用CMake和MinGW-w64的编译安装 | HuiHut
https://www.cnblogs.com/kensporger/p/12320622.html
https://blog.csdn.net/zhaiax672/article/details/88971248
https://my.oschina.net/u/4313733/blog/4585043
https://blog.csdn.net/qq_37112826/article/details/108871312
https://blog.csdn.net/zhaiax672/article/details/88971248
但是我用cmake编译opencv的过程一直报错。折腾了很久,卸载重装了N次。还因为环境变量冲突卸载了anaconda。
血泪史。
所以放弃了。最后直接下载了编译好的opencv,在VScode上配置成功。
1、官网下载并安装MinGW,CMake。添加环境变量。
2、直接下载编译好的opencv
https://github.com/huihut/OpenCV-MinGW-Build
3、配置环境变量 path:
D:\OpenCV\OpenCV-MinGW-Build-OpenCV-4.5.2-x64\x64\mingw\bin
4、vscode 配置opencv并测试
参考:
https://blog.csdn.net/bankexinan/article/details/112970346