vs2013配置opencv环境
首先本人的opencv版本是opencv2.4.9。
步骤如下:
1. 首先下载opencv2.4.9
2. 配置环境变量:
3. 系统变量:D:\opencv\build\x86\vc12\bin
D:\opencv\build\x64\vc12\bin
1. 用户变量:
1) 添加opencv变量:D:\opencv\build
2) 添加PATH变量(有就不需要添加,但是值需要添加):
D:\opencv\build\x86\vc12\bin
D:\opencv\build\x64\vc12\bin
需要将64位和32位都配上,虽然平时使用默认的还是32位的。
4. 新建项目:
a. Debug目录:
- 包含目录:
D:\opencv\build\include
D:\opencv\build\include\opencv
D:\opencv\build\include\opencv2
2. 库目录:
D:\opencv\build\x86\vc12\lib
D:\opencv\build\x64\vc12\lib
3. 链接器-->输入-->附加依赖项:
- 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
b. release目录:
- 包含目录:
D:\opencv\build\include
D:\opencv\build\include\opencv
D:\opencv\build\include\opencv2
2. 库目录:
D:\opencv\build\x86\vc12\lib
D:\opencv\build\x64\vc12\lib
3. 链接器-->输入-->附加依赖项:
- 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
接下来就可以实现自己的项目了。
运行过程中可能出现的错误:
错误1 error LNK1112: 模块计算机类型“x64”与目标计算机类型“X86”冲突 E:\Windows_caffe\PictureProject\PictureProject\opencv
解决:检查一下库目录中,要包含x64和x86的lib文件
错误2
解决:可能还是路径的问题吧,重新将包含目录和库目录,链接器输入添加了一下就好了。
错误3
解决: 图片文件的路径错误,加上图片文件检测的代码。
总之,出现错误很可能就是lib问价没有添加完整,添加完全。