首页 > 代码库 > Visual Studio 2015 + OpenCV 2.4.9 开发环境搭建
Visual Studio 2015 + OpenCV 2.4.9 开发环境搭建
第一步
安装 Visual Studio 2015 (废话),别忘了勾选C++部分组件
第二步
下载 OpenCV https://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.9/opencv-2.4.9.exe/download
第三步
运行 opencv-2.4.9.exe,解压到指定目录,这里我们解压到 C:\OpenCV2.4.9
第四步
设置环境变量,系统Path,加上,C:\OpenCV2.4.9\opencv\build\x86\vc12\bin
第五步
下载 Visual Studio 2013 的 debug 库,放到上一步的 bin 目录,http://pan.baidu.com/s/1dFIjbt3
第六步
创建 C++ Win32 控制台项目,复制粘贴以下测试代码,在 C:\\users\maxwell\pictures 目录创建图片文件 a.bmp
#include <cv.h> #include <highgui.h> using namespace cv; using namespace std; int main() { Mat img = imread("C:\\\\users\\maxwell\\pictures\\a.bmp"); namedWindow("My Window"); imshow("iMy IMG, img); waitKey(6000); return 0; }
第七步
设置项目属性
VC++目录->包含目录,C:\OpenCV2.4.9\opencv\include;C:\OpenCV2.4.9\opencv\include\opencv;C:\OpenCV2.4.9\opencv\build\include\opencv2
库目录,C:\OpenCV2.4.9\opencv\build\x86\vc12\lib
C/C++->命令行->其他选项,/D_CRT_SECURE_NO_WARNINGS
连接器->输入->附加依赖项,
opencv_ml249d.lib opencv_calib3d249d.lib opencv_contrib249d.lib opencv_core249d.lib opencv_features2d249d.lib opencv_flann249d.lib opencv_gpu249d.lib opencv_highgui249d.lib opencv_imgproc249d.lib opencv_legacy249d.lib opencv_objdetect249d.lib opencv_ts249d.lib opencv_video249d.lib opencv_nonfree249d.lib opencv_ocl249d.lib opencv_photo249d.lib opencv_stitching249d.lib opencv_superres249d.lib opencv_videostab249d.lib opencv_objdetect249.lib opencv_ts249.lib opencv_video249.lib opencv_nonfree249.lib opencv_ocl249.lib opencv_photo249.lib opencv_stitching249.lib opencv_superres249.lib opencv_videostab249.lib opencv_calib3d249.lib opencv_contrib249.lib opencv_core249.lib opencv_features2d249.lib opencv_flann249.lib opencv_gpu249.lib opencv_highgui249.lib opencv_imgproc249.lib opencv_legacy249.lib opencv_ml249.lib
第八步
编译运行
Visual Studio 2015 + OpenCV 2.4.9 开发环境搭建
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。