http://www.opencv.org.cn/ 下载OpenCV安装程序。假如要将OpenCV安装到C:\Program Files\OpenCV。(下面附图为OpenCV 1.0rc1的安装界面,OpenCV 1.0安装界面与此基本一致。)在安装时选择"将\OpenCV\bin加入系统变量"(Add\OpenCV\bin to the systerm PATH)。

Image:Opencv-install-step1.png Image:Opencv-install-step2.png Image:Opencv-install-step3.png Image:Opencv-install-step4.png

配置Windows环境变量

检查C:\Program Files\OpenCV\bin是否已经被加入到环境变量PATH,如果没有,请加入。加入后需要注销当前Windows用户(或重启)后重新登陆才生效。(可以在任务管理器里重启explorer.exe)

Image:Path-envirionment-var1.png Image:Path-envirionment-var2.png

配置Visual C++ 6.0

全局设置

菜单Tools->Options->Directories:先设置lib路径,选择Library files,在下方填入路径:

C:\Program Files\OpenCV\lib

然后选择include files,在下方填入路径:

C:\Program Files\OpenCV\cxcore\include
C:\Program Files\OpenCV\cv\include
C:\Program Files\OpenCV\cvaux\include
C:\Program Files\OpenCV\ml\include
C:\Program Files\OpenCV\otherlibs\highgui
C:\Program Files\OpenCV\otherlibs\cvcam\include

Image:VC-directories-setting.png

项目设置

每创建一个将要使用OpenCV的VC Project,都需要给它指定需要的lib。菜单:Project->Settings,然后将Setting for选为All Configurations,然后选择右边的link标签,在Object/library modules附加上

cxcore.lib cv.lib ml.lib cvaux.lib highgui.lib cvcam.lib

如果你不需要这么多lib,你可以只添加你需要的lib。 Image:VC-project-setting.png

Posted on 2008-10-23 17:14  leivo  阅读(885)  评论(0编辑  收藏  举报