vs配置opencv

时间:2021-01-10 03:46:03

配置OpenCv:

一、新建工程

无论是mfc还是控制台程序都可以。

二、下载opencb,安装在非空格路径下面

解压出来有两个文件夹:build和source,主要用到build,build-x86里有三个文件夹,针对不同的vs版本:vc10 = Visual Studio 2010,vc11 = Visual Studio 2012,vc12 = Visual Studio 2013。

三、配置环境

1、  包含目录

右键项目-属性-C++目录-包含目录,添加

opencv\build\include

opencv\build\include\opencv

opencv\build\include\opencv2 这三个目录(记得是绝对路径,这里没有写全)

2、  库目录

右键项目-属性- C++目录-库目录,添加

opencv\build\x86\vc10\lib(记得是绝对路径,这里没有写全,x86表示32位电脑,x64表示64位电脑)

3、 链接库

右键项目-属性-链接器-输入-附加依赖项,添加opencv\build\x86\vc12\lib里的lib文件,如

opencv_calib3d2410.lib代表release版本,

opencv_calib3d2410d.lib代表debug版本;

在附加依赖项里:按顺序先添加所有debug的lib,再添加release的版本:

opencv_ml2410d.lib

opencv_calib3d2410d.lib

opencv_contrib2410d.lib

opencv_core2410d.lib

opencv_features2d2410d.lib

opencv_flann2410d.lib

opencv_gpu2410d.lib

opencv_highgui2410d.lib

opencv_imgproc2410d.lib

opencv_legacy2410d.lib

opencv_objdetect2410d.lib

opencv_ts2410d.lib

opencv_video2410d.lib

opencv_nonfree2410d.lib

opencv_ocl2410d.lib

opencv_photo2410d.lib

opencv_stitching2410d.lib

opencv_superres2410d.lib

opencv_videostab2410d.lib

opencv_objdetect2410.lib

opencv_ts2410.lib

opencv_video2410.lib

opencv_nonfree2410.lib

opencv_ocl2410.lib

opencv_photo2410.lib

opencv_stitching2410.lib

opencv_superres2410.lib

opencv_videostab2410.lib

opencv_calib3d2410.lib

opencv_contrib2410.lib

opencv_core2410.lib

opencv_features2d2410.lib

opencv_flann2410.lib

opencv_gpu2410.lib

opencv_highgui2410.lib

opencv_imgproc2410.lib

opencv_legacy2410.lib

opencv_ml2410.lib