Vs2013中opencv的配置(添加属性表)

网上有很多VS2013的opencv配置教程,我也走了不少弯路。终于找到了比较好的一种方式。

VS2013和opencv3.0的下载和安装就不再累述。

以下我们从配置环境开始:

1.打开计算机的属性页,找到环境变量


Vs2013中opencv的配置(添加属性表)_第1张图片


2.在系统环境变量下新建下列选项


Vs2013中opencv的配置(添加属性表)_第2张图片


3.在系统变量中找到Path变量并在最后加上下面语句

 ;%OPENCV%\x86\vc12\bin


Vs2013中opencv的配置(添加属性表)_第3张图片


4.

在OpenCV的根目录下新建文件opencv300.props,这个文件将会在下面的VS2013配置中用到(建props文件可以先新建文本文件,输入以下内容后,再改后缀名即可)


文件内容为:




 
 
 
    $(OPENCV)\include;$(IncludePath)
  $(OPENCV)\x86\vc12\staticlib;$(OPENCV)\x86\vc12\lib;$(LibraryPath)
    $(OPENCV)\x64\vc12\staticlib;$(OPENCV)\x64\vc12\lib;$(LibraryPath)
 

 
   
      opencv_ts300.lib;opencv_world300.lib;opencv_calib3d300.lib;opencv_core300.lib;opencv_features2d300.lib;opencv_flann300.lib;opencv_highgui300.lib;opencv_imgcodecs300.lib;opencv_imgproc300.lib;opencv_ml300.lib;opencv_objdetect300.lib;opencv_photo300.lib;opencv_shape300.lib;opencv_stitching300.lib;opencv_superres300.lib;opencv_ts300.lib;opencv_video300.lib;opencv_videoio300.lib;opencv_videostab300.lib;%(AdditionalDependencies)
   
   
      opencv_ts300d.lib;opencv_world300d.lib;opencv_calib3d300d.lib;opencv_core300d.lib;opencv_features2d300d.lib;opencv_flann300d.lib;opencv_highgui300d.lib;opencv_imgcodecs300d.lib;opencv_imgproc300d.lib;opencv_ml300d.lib;opencv_objdetect300d.lib;opencv_photo300d.lib;opencv_shape300d.lib;opencv_stitching300d.lib;opencv_superres300d.lib;opencv_ts300d.lib;opencv_video300d.lib;opencv_videoio300d.lib;opencv_videostab300d.lib;%(AdditionalDependencies)
   
 

 

文件内容如下图


Vs2013中opencv的配置(添加属性表)_第4张图片


5:打开VS2013,新建一个空的Win32 控制台应用程序,工程名为OpencvTest



Vs2013中opencv的配置(添加属性表)_第5张图片


6:选择菜单栏中的“视图”——“属性管理器”——右击项目“添加现有属性”


Vs2013中opencv的配置(添加属性表)_第6张图片



7:添加现有属性成功后如下图所示


Vs2013中opencv的配置(添加属性表)_第7张图片


8:

然后测试代码

打开摄像头:

 

#include   

#include   

#include   

using namespace cv;

 

int main()

{

VideoCapture cap(0);

Mat frame;

while (1)

{

cap >> frame;

imshow("调用摄像头", frame);

waitKey(30);

}

return 0;

}

9.如果成功那就大功告成啦啦啦 

你可能感兴趣的:(#,opencv)