从http://www.opencv.org.cn 下载OpenCV安装程序。假如要将OpenCV安装到C:/Program Files/OpenCV。在安装时选择"将/OpenCV/bin加入系统变量"(Add/OpenCV/bin to the systerm PATH)。
配置Windows环境变量
检查C:/Program Files/OpenCV/bin是否已经被加入到环境变量PATH,如果没有,请加入。加入后需要注销当前Windows用户(或重启)后重新登陆才生效。(可以在任务管理器里重启explorer.exe)
配置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
然后选择source files,在下方填入路径:
C:/Program Files/OpenCV/cv/src C:/Program Files/OpenCV/cxcore/src C:/Program Files/OpenCV/cvaux/src C:/Program Files/OpenCV/otherlibs/highgui C:/Program Files/OpenCV/otherlibs/cvcam/src/windows
最后点击“ok”,完成设置。
项目设置
每创建一个将要使用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。
更多详见Opencv 中文网站