OpenCV2.4.4版环境配置

时间:2023-01-20 09:34:37

目标:在VS2010中配置OpenCV2.4.4库,用于(OpenCV+C++)联合开发;操作系统为32/64位Win7

一.下载安装OpenCV2.4.4

    下载地址 http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.4/OpenCV-2.4.4.exe/download   

   下载得到文件OpenCV2.4.4版环境配置,运行解压,在这里选择安装路径OpenCV2.4.4版环境配置,我选择的是D盘。这样安装完成之后,OpenCV2.4.4将被安装在D:\opencv\这个文件夹里。

二.设置电脑环境(注意:这一步设置完请重启电脑生效!)

    (Windows键+Pause/Break)→高级系统设置→环境变量,得到如下窗口:

         OpenCV2.4.4版环境配置

 1. “user的用户变量”设置(第一个框)

    设置Path:选中Path→编辑(若找不到Path,则新建一个)。在“变量值”选项后面添加以下路径:D:\opencv\build\x86\vc10\bin

    新建OpenCV变量:单击新建→在弹出的窗口中将“变量名”和“变量值”分别设置为OpenCV和D:\opencv\build

注意:

  a.添加路径时要加";"以与前面的路径区分开,最后一个路径末尾不加";";

  b.路径前面的D:\opencv\为OpenCV2.4.4的安装路径,可根据情况修改。

2.“系统变量”设置(第二个框)

  设置Path:选中Path→编辑。添加路径:D:\opencv\build\x86\vc10\bin

三、配置VS2010

  打开VS2010,新建一个Win32控制台空项目。点击“视图”→“属性管理器”,然后打开“Debug| Win32”→“Microsoft.Cpp.Win32.user”(双击),弹出如下窗口:

OpenCV2.4.4版环境配置

 1.点击”VC++目录“,在对应的目录后分别添加如下路径(注意是”添加“,之前的路径不要删掉了!)

   可执行文件目录:D:\opencv\build\x86\vc10\bin

   包含目录:D:\opencv\build\include;D:\opencv\build\include\opencv;D:\opencv\build\include\opencv2

       库目 录:D:\opencv\build\x86\vc10\lib

 2.点击 “链接器”→“输入”,在第一行”附加依赖项“里添加D:\opencv\build\x86\vc10\lib文件夹里的所有lib文件名称:(下面为2.4.4版里的lib)

opencv_calib3d244d.lib opencv_contrib244d.lib opencv_core244d.lib opencv_features2d244d.lib opencv_flann244d.lib opencv_gpu244d.lib opencv_highgui244d.lib opencv_imgproc244d.lib opencv_legacy244d.lib opencv_ml244d.lib opencv_nonfree244d.lib opencv_objdetect244d.lib opencv_photo244d.lib opencv_stitching244d.lib opencv_ts244d.lib opencv_video244d.lib opencv_videostab244d.lib opencv_calib3d244.lib opencv_contrib244.lib opencv_core244.lib opencv_features2d244.lib opencv_flann244.lib opencv_gpu244.lib opencv_highgui244.lib opencv_imgproc244.lib opencv_legacy244.lib opencv_ml244.lib opencv_nonfree244.lib opencv_objdetect244.lib opencv_photo244.lib opencv_stitching244.lib opencv_ts244.lib opencv_video244.lib opencv_videostab244.lib