【OpenCV学习】在不同版本的VS下的配置方法

作者:gnuhpc
出处:http://www.cnblogs.com/gnuhpc/

///////////////////////////.NET下配置///////////////////////////////////////
1.安装opencv
2.Tools.Options/Projects/VC++ Directories包含
     apps/HaarTraining/include
     cv/include
     cvaux/include
     cxcore/include
     otherlibs/_graphics/include
     otherlibs/cvcam/include
     otherlibs/highgui
Tools.Options/Projects/VC++ Directories/library files包含
     LIB
     OTHERLIBS
     OTHERLIBS/_GRAPHICS/LIB
     OTHERLIBS/CVCAM
     OTHERLIBS/HIGHGUI
3.Project/** Projects/Linker/Input:Additional Dependency 输入
     cv.lib highgui.lib cxcore.lib
4.所有使用函数处需包含
     cv.h, high.h, cxcore.h
如果之后安装Visual Assist不能提示openCv函数,需如下配置
1.VAssistX->Visual Assist X Options
2.Projects->C/C++ Directories
3.Show Directories->Stable Include Files
4.包含
     apps/HaarTraining/include
     cv/include
     cvaux/include
     cxcore/include
     otherlibs/_graphics/include
     otherlibs/cvcam/include
     otherlibs/highgui
///////////////////////////VC 6下配置///////////////////////////////////////
1.安装OPEN CV
2.如果在安装时为设置环境变量,要在“我的电脑”“属性”“高级”“环境变量”中添加上述变量,如:变量:Path,值:C:/OpenCV/bin;
3.*打开OpenCV安装目录下的_make文件夹,启动其中的opencv.dsw工程(如: C:/OpenCV/_make/opencv.dsw);进行批构建(batch build),注意只选择 Win32 debug和Win32 release就可以了。
在生成过程中可能会出现如下错误:
“fatal error LNK1181: 无法打开输入文件“cvauxd.lib”
“error C2039: “foreground_regions” : 不是“CvFGDStatModel”的成员”
解决的方法是:在“FileView”中打开“cvaux”项目的包含文件中(Include/External)的cvaux. h文件,找到上述foreground_regions成员,会发现此成员已被注释掉了,只要将其上一行末尾的“/”改为“*/”使该成员可见,再次启动项目,应该就可以编译通过了。
4.*启动_make目录下的另外一个工程“opencv_directshow.dsw” ,使其编译通过.
5.Tools.Options/Projects/VC++ Directories/include包含
     apps/HaarTraining/include
     cv/include
     cvaux/include
     cxcore/include
     otherlibs/_graphics/include
     otherlibs/cvcam/include
     otherlibs/highgui
6.Tools.Options/Projects/VC++ Directories/library files包含
     LIB
     OTHERLIBS
     OTHERLIBS/_GRAPHICS/LIB
     OTHERLIBS/CVCAM
     OTHERLIBS/HIGHGUI
7.新建项目时.在project - settings -all configurations (工程-选项-设置全部)中选择 Link,在对象/库模块中加入静态库cvd.lib highguid.lib cvauxd.lib cxcored.lib cvcam.lib
8.源文件中加入
#include "cv.h"
#include "highgui.h"
#include "cxcore.h"

作者:gnuhpc
出处:http://www.cnblogs.com/gnuhpc/

posted @ 2012-12-09 14:20  gnuhpc  阅读(1524)  评论(0编辑  收藏  举报