欢迎来到天天文库
浏览记录
ID:37712014
大小:15.00 KB
页数:5页
时间:2019-05-29
《OpenCV 2.4.9 +VS2013 开发环境配置》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、OpenCV2.4.9+VS2013开发环境配置OpenCV的全称是:OpenSourceComputerVisionLibrary。OpenCV是一个基于(开源)发行的跨平台计算机视觉库,可以运行在Linux、Windows和MacOS操作系统上。它轻量级而且高效——由一系列C函数和少量C++类构成,同时提供了Python、Ruby、MATLAB等语言的接口,实现了图像处理和计算机视觉方面的很多通用算法。现本教程,是在windows平台下使用visualstudio2013和opencv2.4.9配置一个开发环境。工具/原料opencv2.4.9vs2013方法/步骤1安装opencv2.
2、4.9,解压,请务必记住自己解压的路径。宜家以我自己的路径为例D:ProgramFiles2配置环境变量1、系统变量Path:添加D:ProgramFilesopencvbuildx86vc12bin2、用户变量:添加opencv变量,值D:ProgramFilesopencvbuild,添加PATH变量(有就不需要添加,但是值需要添加)值D:ProgramFilesopencvbuildx86vc12bin说明:不管你系统是32位还是64位,路径目录均选择X86,因为编译都是使用32位编译;如果选用X64,则程序运行时候会出错。3新建visualC项目新建
3、visualC++项目,如下图所示,项目选项注意:如下图。4工程目录的配置(Debug)找到属性管理器,如果找不到,请安装下图方法找到。双击Debug
4、Win32打开如下窗口,设置如下:(下图红框项为设置项)1、包含目录:(VC++目录)D:ProgramFilesopencvbuildincludeD:ProgramFilesopencvbuildincludeopencvD:ProgramFilesopencvbuildincludeopencv22、库目录:(VC++目录)D:ProgramFilesopencvbuildx86vc12lib3、
5、连接器->输入->附加依赖项:opencv_ml249d.libopencv_calib3d249d.libopencv_contrib249d.libopencv_core249d.libopencv_features2d249d.libopencv_flann249d.libopencv_gpu249d.libopencv_highgui249d.libopencv_imgproc249d.libopencv_legacy249d.libopencv_objdetect249d.libopencv_ts249d.libopencv_video249d.libopencv_nonfree2
6、49d.libopencv_ocl249d.libopencv_photo249d.libopencv_stitching249d.libopencv_superres249d.libopencv_videostab249d.lib其实以上都是D:ProgramFilesopencvbuildx86vc12lib下所有的lib文件,你会发现,有的后面带上d,有的没有d,这是因为Debug的就有d,Release则没有d。工程目录的配置(Release)其他与Debug一样,只是连接器->输入->附加依赖项不一样,设置如下:opencv_objdetect249.libopencv
7、_ts249.libopencv_video249.libopencv_nonfree249.libopencv_ocl249.libopencv_photo249.libopencv_stitching249.libopencv_superres249.libopencv_videostab249.libopencv_calib3d249.libopencv_contrib249.libopencv_core249.libopencv_features2d249.libopencv_flann249.libopencv_gpu249.libopencv_highgui249.libopen
8、cv_imgproc249.libopencv_legacy249.libopencv_ml249.lib最终的测试1、新建一个cpp文件,如下图:在cpp文件上输入以下代码:#include#includeusingnamespacestd;intmain(){IplImage*test;test=cvLoadImage("D:\Sample_8.bmp");//图片路径
此文档下载收益归作者所有