资源描述:
《visual studio 2010下成功配置opencv2.4.2》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、VisualStudio2010下成功配置OpenCV2.4.2环境:XPSP3+32位系统+VisualStudio2010+opencv2.4.2一、准备工作下载VisualStudio2010(本人使用的是中文旗舰版)下载OpenCV2.4.2,下载地址:http://opencv.org/二、安装文件安装VisualStudio2010(略)安装OpenCV2.4.2,把它解压你电脑中指定的位置,别人解压到D:ProgramFilesOpenCV下,解压完后应该是D:ProgramFilesOpenCVopencv,如下图:2012-9-510:41
2、上传下载附件(19.13KB)otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOffi
3、ceoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand三、打开VisualStudio2010,新建一个空白项目OpenCVTest,在源文件中增加test.cpp文件,文件中的代码为:2012-9-510:41上传下载附件(40.4KB)代码如下:1./****************
4、*******************2.**OpenCV2.4.2测试项目3.*CAOJUN4./**********************************/5.#include6.7.usingnamespacestd;8.usingnamespacecv;9.10.intmain(intargc,char*argv[])11.{12.constchar*pImg="D:/op/lena.jpg";13.otherstaffoftheCentre.Duringthewar,Zhuwastransferredback
5、toJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,Direc
6、torofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand1.//从文件中读入图像2.Matimg=imread(pImg);3.4.//如果读入图像失败5.if(img.empty())6.{7.fprintf(stderr,"Cannotloadimage%s",pImg);8.return-1;9.}10.11.//显示图像12.imshow("image",img);13.14.//此函数等待按键,按键盘任意键就返回1
7、5.waitKey();16.17.return0;18.}四、配置VS1、配置include路径:也即告诉VS去哪里寻找OpenCV的头文件,在上图左栏右击“OpenCVTest”,在点击属性,就会出现如下对话框:2012-9-510:41上传下载附件(26.04KB)otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin19