VS2015配置OpenCV2.4.9 (win7系统)
VS2015配置OpenCV2.4.9 (win7系统)
- OpenCV
(1). 官网下载OpenCV并解压缩
(2). 配置OpenCV环境变量
添加OpenCV路径,如:
64位:
添加 D:\Program File\opencv2.4.9\opencv\build\x64\vc12\bin;
D:\Program File\opencv2.4.9\opencv\build\x86\vc12\bin
32位:
添加 D:\Program File\opencv2.4.9\opencv\build\x86\vc12\bin
添加用户变量
D:\Program File\opencv2.4.9\opencv\build
至此,环境变量配置结束。
2. VS2015
(1). 新建win32控制台项目
点击“确定”->“下一步”->“空项目”
(2). 新建源文件
测试代码:
#include <highgui.h>
#include <iostream>
using namespace cv;
void main()
{
IplImage *src = cvLoadImage("lena.jpg"); //这里将lena.jpg和lena.cpp文件放在同一个文件夹下
cvNamedWindow("lena", CV_WINDOW_AUTOSIZE);
cvShowImage("lena", src);
cvWaitKey(0);
cvDestroyWindow("lena");
cvReleaseImage(&src);
}
(3). 配置OpenCV(以Debug|Win32为例)
添加可执行文件
添加 D:\Program File\opencv2.4.9\opencv\build\x86\vc12\bin
Release|Win32同上
Debug/Release|x64添加D:\Program File\opencv2.4.9\opencv\build\x64\vc12\bin
接下来分别添加包含目录和库目录
配置包含目录时 Release|Win32 Debug/Release|x64均同上
添加库目录时,Release|Win32同上,Debug/Release|x64将x86改为x64
下面添加附加依赖项:
Debug附加依赖项:
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_ml249d.lib
opencv_nonfree249d.lib
opencv_objdetect249d.lib
opencv_ocl249d.lib
opencv_photo249d.lib
opencv_stitching249d.lib
opencv_superres249d.lib
opencv_ts249d.lib
opencv_video249d.lib
opencv_videostab249d.lib
Release附加依赖项:
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
opencv_nonfree249.lib
opencv_objdetect249.lib
opencv_ocl249.lib
opencv_photo249.lib
opencv_stitching249.lib
opencv_superres249.lib
opencv_ts249.lib
opencv_video249.lib
opencv_videostab249.lib
至此,配置完成。
3. 测试代码运行
打开配置管理器
X86和x64均选择win32
运行时可能提示缺少msvcp120d.dll文件,下载,并将其添加到D:\Program File\opencv2.4.9\opencv\build\x86\vc12\bin
D:\Program File\opencv2.4.9\opencv\build\x64\vc12\bin
即可解决。
推荐阅读
-
VS2015配置OpenCV2.4.9 (win7系统)
-
WIN7系统JavaEE(java)环境配置教程(一)
-
WIN7系统JavaEE(tomcat7 Eclipse)环境配置教程(二)
-
win7 64位系统JDK安装配置环境变量教程
-
WIN7系统JavaEE(tomcat7 Eclipse)环境配置教程(二)
-
WIN7系统JavaEE(java)环境配置教程(一)
-
win7 64位系统JDK安装配置环境变量教程
-
win7系统下如何配置php-Apache-mysql环境,win7apache配置
-
win7 64位系统 配置php最新版开发环境(php+Apache+mysql),win7apache_PHP教程
-
PHP+Apache+MySQL+phpMyAdmin在win7系统下的环境配置