Opencv2.4.9、VS2010配置及grabcut代码实例

最近opencv库更新到了2.4.9,作为小码农的我紧跟时代的步伐,装了2.4.9这个库。以下是我的配置步骤:

1、从http://opencv.org/上下载opencv2.4.9文件,由于我用的是windows,直接下载那个exe文件;

2、双击已下载的exe文件,将之解压到你的安装目录,我的是:D:\Program Files\opencv,你可以根据自己喜好解压到你指定的目录;

3、增加环境变量,系统属性->环境变量->编辑path,加上D:\Program Files\opencv\opencv\build\x86\vc10\bin,并用“;”号和前面的环境变量相隔开;

4、用VS2010新建一个控制台程序,右击解决方案的工程名,打开属性框;

4.1 配置属性->VC++目录

包含文件添加:D:\Program Files\opencv\opencv\build\include\opencv2

D:\Program Files\opencv\opencv\build\include\opencv   

D:\Program Files\opencv\opencv\build\include

库目录添加:D:\Program Files\opencv\opencv\build\x86\vc10\lib

以上操作release和debug一样。

4.2 链接器->输入->附加依赖项

release:

opencv_calib3d249.lib
opencv_contrib249.lib
opencv_core249.lib
opencv_features2d249.lib
opencv_flann249.lib
opencv_gpu249.lib
opencv_highgui249.lib
opencv_imgproc249.lib
opencv_legacy249.lib
opencv_ml249.lib
opencv_objdetect249.lib
opencv_ts249.lib
opencv_video249.lib

debug:

opencv_calib3d249d.lib
opencv_contrib249d.lib
opencv_core249d.lib
opencv_features2d249d.lib
opencv_flann249d.lib
opencv_gpu249d.lib
opencv_highgui249d.lib
opencv_imgproc249d.lib
opencv_legacy249d.lib
opencv_ml249d.lib
opencv_objdetect249d.lib
opencv_ts249d.lib
opencv_video249d.lib


5、测试一下

结果运行如下:
Opencv2.4.9、VS2010配置及grabcut代码实例_第1张图片
Opencv2.4.9、VS2010配置及grabcut代码实例_第2张图片

OK,表明配置成功了!

你可能感兴趣的:(OpenCV2.4.9,GrabCut)