Visual Studio 安装OpenCV及问题总结

您所在的位置:网站首页 opencv安装失败 Visual Studio 安装OpenCV及问题总结

Visual Studio 安装OpenCV及问题总结

2022-06-07 21:21| 来源: 网络整理| 查看: 265

1、VS安装OpenCV基本步骤   1)安装Visual Studio

    下载网址https://opencv.org/releases.html#

  2)安装OpenCV 

    下载网址https://www.visualstudio.com/zh-hans/,直接下载社区版免费

  3)环境变量配置(配置后重启电脑)     D:\OpenCV\opencv\build\x64\vc15\bin添加到环境变量中   4)创建C++空工程   5)编译环境选择

    X86(32位)或者X64(64位)

    Debug或者Release

  6)添加以下文件夹到“Include Directories”中

    D:\OpenCV\opencv\build\include

    D:\OpenCV\opencv\build\include\opencv

    D:\OpenCV\opencv\build\include\opencv2

  7)添加以下文件到“Library Directories”中

    D:\OpenCV\opencv\build\x64\vc15\lib

  8)添加以下语句到Linker->Input->Additional Dependencies

    若上面选择Release,则添加"opencv_world320.lib"(注:320根据版本号修改)

    若上面选择Debug,则添加“opencv_world320.lib”

  9)添加程序代码运行 1 #include 2 #include 3 4 using namespace cv; 5 int main(int arg, char *argv[]) {      //图片路径不要出现中文 6 Mat img = imread(argv[1], CV_LOAD_IMAGE_ANYCOLOR); 7 if (!img.data) { 8 return -1; 9 } 10 imshow("原图", img); 11 waitKey(0); 12 return 1; 13 } 2、若出现如下截屏的问题 3、解决方案     将目录D:\OpenCV\opencv\build\x64\vc15\bin下的三个以dll结尾的文件复制到C:\Windows\System32,注意:64位系统用户需要注意,32位的DLL文件放在“C:\Windows\SysWOW64”,64位的DLL文件放在“C:\Windows\System32”,方便起见可同时复制到那两个文件夹中。 4.其他     一个OpenCV可能有VC14和VC15,最终根据VS版本来选择。

IDE

编译器

VS2017

VC15

VS2015

VC14

VS2013

VC12

VS2012

VC11

VS2010

VC10

VS2008

VC9

VS2005

VC8



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3