OpenCV2.4.9在Visual Studio 2013下的配置
来源:互联网 发布:linux 循环打开文件 编辑:程序博客网 时间:2024/04/30 21:15
Reference:
1)http://opencv-srf.blogspot.com/2013/05/installing-configuring-opencv-with-vs.html;
2)A book named “OpenCV2 Computer Vision Application Programming Cookbook”, Page 11-18;
3)http://blog.csdn.net/poem_qianmo/article/details/19809337;
4)http://blog.csdn.net/mdl13412/article/details/8289972;
5)http://docs.opencv.org/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html#windows-visual-studio-how-to
1.下载visual studio 2013软件和OpenCV2.4.9
1)visual studio 2013下载免费版:
https://www.dreamspark.com/Product/Product.aspx?productid=72
在这个网址下,先注册一个账户,再用学校的邮箱验证,就可以免费下载、使用了vs2013了。如下图所示:
2)下载OpenCV2.4.9:goto the website:
地址如下:http://opencv.org/downloads.html
2. 配置环境变量(environment variables):
1) 新建一个用户或者系统变量(二者任选一个即可):
我选的是to build a user variable。变量名:OPENCV2_DIR,变量值:D:\OpenCV249\opencv\build。这是因为我将OpenCV2.4.9解压库到D:\OpenCV249这个目录下了,所以变量值相应的设成这个了。
2)添加系统路径
Now you are going to edit a systemvariable.
i) click 'Path'or 'PATH' inside the list of System variables and then click 'Edit' buttonat the bottom of the window.
ii) Then add asemicolon(即:分号“;”) to the endof the line and add the following %OPENCV2_DIR%\x86\vc12\bin after the semicolon. X86 isyour system architecture and vc12 is the compiler type. How to find your systemarchitecture and compiler type is explained at the beginning of the post.(Don't delete anything. Just append it at the end of the line.)
注:后面的图片中显示的路径是“x64”,那是因为我理解我的操作系统是64bits的,就用了x64,结果发现程序调试时会有错误,如下:
可以理解这段话:
其实配置选择什么跟64位还是32位操作系统没有直接的关系,而是在于编译你的程序时候,是使用那个编译器。
编译器选的是win32,就用x86。编译器选的是X64,就用X64。不过一般情况下,都是用的win32的X86编译器。所以,无论32还是64位操作系统,配置文件最好都选择x86版的。另外,这里的vc10表示vs2010,如果是其他版本的visual studio,稍微调整一下即可。
3. Configure Visual Studio2013
1)创建一个简单的visual studio 2013的win32Console Application:
File|New Project| Project …
2) Create a Property Sheet
Tobe able to compile and run your future OpenCV application, you need to tellVisual C++ where to find the OpenCV libraries and include files. Since you willprobably create several OpenCV projects in the future, the best option is tocreate a Property Sheet that you will be able to reuse from project to project.This is done through thePropertyManager. 如果Property Manager未显示在IDE中,可以通过View 菜单调出该项。
3)先做Debug | win 32
A)Edit theInclude Directories textfieldand add the path to the include files of your OpenCV library.
B)Do the samething with theLibrary Directories. See the followingpicture.
C) the next step is to specify the OpenCVlibrary files which need to be linked with your code in order to produce anexecutable application. 索性就把所有的modules都添加进来。Note: 这些文件是以字母d结尾的,d 代表debug;
4)再做Release | win 32
参考步骤“3)先做Debug | win 32”Note: 这些文件不是以字母d结尾的,对应代表release模式。
n Summary:
UserVariable:
OPENCV2_DIR= D:\OpenCV249\opencv\build;
$(OPENCV2_DIR)\include
%OPENCV2_DIR%\x86\vc12\bin
$(OPENCV2_DIR)\x86\vc12\lib
4. 一个小例子测试一下:
#include<iostream>
#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
usingnamespace cv;
usingnamespace std;
int main()
{
// 读入一张图片
Mat img = imread("D:\\tiger.jpg");
if (!img.data)
{
cout << "No image hasnot been created!"<<endl;
}
// 创建一个名为 "Fig1"窗口
cvNamedWindow("Fig1");
// 在窗口中显示改图
imshow("Fig1", img);
waitKey();
return 0;
}
Result:
5. 附录OPENCV2.4.9 – x86 lib文件名:
1) 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
2) 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
6. 一些编译、运行时的错误(详见Reference 3)- OpenCV2.4.9在Visual Studio 2013下的配置
- openCV2.3在visual studio 2010下的配置
- opencv2.4.9在visual studio 2013中的配置
- Visual Studio 2010 +Opencv2.3.1下的配置关键步骤
- Visual Studio 2010 +Opencv2.3.1下的配置关键步骤
- visual studio 2010下配置OpenCV2.1
- Visual Studio 2010 下配置Opencv2.3.1
- Visual Studio 2010下配置opencv2.3.1
- Visual Studio 2010 下配置 OpenCV2.4.2
- 基于win8的 opencv2.4.8 在visual studio 2013上的配置 win32
- 虚拟视点VSRS3.5+opencv2.4.9在Visual Studio 2013中的配置
- Visual Studio 2013中OpenCV2.4.9的配置(64位的配置)
- Visual Studio+Opencv2.4.9环境配置
- Visual Studio 2010 配置 openCV2.4.9
- Visual Studio 2010配置Opencv2.4.9
- Visual Studio 2010配置Opencv2.4.9
- Visual Studio 2010配置Opencv2.4.9
- Win7下安装配置OpenCV2.3+Visual Studio 2008
- uva 11992 线段树对矩阵进行更新查询
- iOS 获取当前时间格式化字符串
- iOS 捕获系统外异常
- iOS 捕获未知方法的调用,避勉抛出异常
- sql server2000中使用convert来取得datetime数据类型样式(全)
- OpenCV2.4.9在Visual Studio 2013下的配置
- Installing and Configuring ODBC
- ubuntu安装hadoop详细步骤
- 资源dll的制作与使用
- HilbertCurve 希尔伯特遍历的递归实现
- linux SecureCRT ssh key认证登陆
- 《算法竞赛入门经典》上机练习——第一章
- iOS Foundation 框架中 Mutable 的类们
- 安装linux系统后,笔记本触摸板,那些让人蛋疼的事!