首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > VSTS >

OpenCV2.4.3在VS2010上的安装

2013-01-27 
OpenCV2.4.3在VS2010下的安装opencv的最新版本为OpenCV2.4.3。比来要开端进修opencv了,所以在网上查找了Ope

OpenCV2.4.3在VS2010下的安装

opencv的最新版本为OpenCV2.4.3。


比来要开端进修opencv了,所以在网上查找了OpenCV2.4.3的安装办法,如今本身收拾了下:


 1.下载OpenCV-2.4.3.exe


2. 双击exe解压到本身想安装的目次,我解压到的目次为:


D:\Program Files\OPencv2.4.3


 3. 设备景象变量,在体系景象变量设备下面的景象变量,经过测试,只须要在体系变量下设备,并不须要在用户变量下也设备。(与opencv2.4.2不合的是,此时因为2.4.3版本的opencv内嵌了TBB的功能,所以作废了TBB直接安装,如许就不须要再设备TBB景象变量了。)


变量名: 变量值:


PATH:      D:\Program Files\OPencv2.4.3\opencv\build\x86\vc10\lib



4.打开VS2010,建树一个Win32空的把握台法度helloopencv


View->Property Manager(视图—>属性经管器),在窗口左侧本来的Solution Explorer的地位呈现Property Manager页面(使属性经管器一栏显示出来),选择Debug|Win32下面的Microsoft.Cpp.Win32.user,弹出Microsoft.Cpp.Win32.userProperty属性页如下:





在弹出的窗口中,找到VC++ 目次,进行针对Debug的目次设备。


在Include Directories(包含目次)中,参加目次:


D:\Program Files\OPencv2.4.3\opencv\build\include


D:\Program Files\OPencv2.4.3\opencv\build\include\opencv


D:\Program Files\OPencv2.4.3\opencv\build\include\opencv2


在库目次下参加:


D:\Program Files\OPencv2.4.3\opencv\build\x86\vc10\lib



5.设置项目属性。在SolutionExplorer的helloopencv上右键选择Properties,在弹出的helloopencvProperty Pages窗口中,在链接器Link下的输入Input,为项目标Debug设备增长附加依附项AdditionalDependecies:



opencv_calib3d243d.lib; opencv_contrib243d.lib; opencv_core243d.lib;opencv_features2d243d.lib; opencv_flann243d.lib; opencv_gpu243d.lib;opencv_highgui243d.lib; opencv_imgproc243d.lib; opencv_legacy243d.lib;opencv_ml243d.lib; opencv_objdetect243d.lib; opencv_ts243d.lib; opencv_video243d.lib


(可按照实际须要删减)



同理,为项目标Release选项增长依附项,操纵过程类似,只是在helloopencv最左侧的Configuration中,下拉选项选择“Release”即可。Release中须要增长的依附项为:


opencv_calib3d243.lib; opencv_contrib243.lib; opencv_core243.lib;opencv_features2d243.lib; opencv_flann243.lib; opencv_gpu243.lib;opencv_highgui243.lib; opencv_imgproc243.lib; opencv_legacy243.lib; opencv_ml243.lib;opencv_objdetect243.lib; opencv_ts243.lib; opencv_video243.lib


(可按照实际须要删减)



6.为项目添加test.cpp。


代码如下:



 1 #include <opencv2/opencv.hpp>    2    3 using namespace std;   4 using namespace cv;   5    6 int main(int argc, char* argv[])   7 {   8     const char* imagename = "core.jpg";   9   10     //从文件中读入图像   11     Mat img = imread(imagename);  12   13     //若是读入图像失败   14     if(img.empty())  15     {  16         fprintf(stderr, "Can not load image %s\n", imagename);  17         return -1;  18     }  19   20     //显示图像   21     imshow("image", img);  22   23     //此函数守候按键,按键盘随便率性键就返回   24     waitKey();  25   26     return 0;  27 }  


编译运行此例程须要将core.jpg文件放在项目目次下,即与生成的.exe文件同地位

热点排行