Author:Maddock

Date:2014.12.27

……………………………………………………………………………………………………

PS: VS2013 + OPENCV 3.0.0 的安装,连接器的输入选项简化为:

#ifndef _OPENCV_LIB_
#define _OPENCV_LIB_

#ifdef _DEBUG
#pragma comment(lib, "opencv_ts300d.lib")
#pragma comment(lib, "opencv_world300d.lib")

#else
#pragma comment(lib, "opencv_ts300.lib")
#pragma comment(lib, "opencv_world300.lib")

#endif

#endif

其他步骤相同。

不过,目前opencv3.0.0的using namespace cv和windows.h中ACCESS_MASK定义冲突,

错误    4    error C2872: “ACCESS_MASK”: 不明确的符号    c:\program files (x86)\windows kits\8.1\include\um\winnt.h    9084    1    opencvtest

注释掉using namespace cv,再所有需要用到cv的地方加cv::……………………………………………………………………………………………

准备工具 windows平台 opencv2.4.10 vs2013

1解压opencv2.4.10.exe,我放在目录 C:\Adisk\software\opencv\opencv2410\opencv

配置环境变量

Path: C:\Adisk\software\opencv\opencv2410\opencv\build\x86\vc12\bin

在x86文件夹内还有vc10,vc11,vc12 3个文件夹,分别对应vs2010,vs2012,vs2013

2 配置VS2013的include 和lib目录

新建win32工程,打开属性管理器(视图–>其他窗口–>属性管理器)

右键Debu32中的Mirosoft.Cpp.Win32.user选择属性,可以看见

编辑包含目录和库目录

包含目录 C:\Adisk\software\opencv\opencv2410\opencv\build\include

库目录 C:\Adisk\software\opencv\opencv2410\opencv\build\x86\vc12\lib

下一步点击连接器的输入选项,编辑附加依赖项,加入

opencv的debug版本和release版本需要的lib不同,但是在编辑右键Debu32中的Mirosoft.Cpp.Win32.user选择属性这一步中,相应的

release版本也跟着变了,如果编译运行debug版本是没有问题,切换到release版本是需要把debug版本去掉,否则opencv中的部分函数将不能

运行。

debug版本
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_ml2410d.lib
opencv_nonfree2410d.lib
opencv_objdetect2410d.lib
opencv_ocl2410d.lib
opencv_photo2410d.lib
opencv_stitching2410d.lib
opencv_superres2410d.lib
opencv_ts2410d.lib
opencv_video2410d.lib
opencv_videostab2410d.lib

release版本
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
opencv_nonfree2410.lib
opencv_objdetect2410.lib
opencv_ocl2410.lib
opencv_photo2410.lib
opencv_stitching2410.lib
opencv_superres2410.lib
opencv_ts2410.lib
opencv_video2410.lib
opencv_videostab2410.lib

3  测试

// opencvtest.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    Mat src = imread("image.png", 0);
    if (src.empty())
    {
        cout << "打开图像失败!" << endl;
        return -1;
    }
    namedWindow("image", CV_WINDOW_AUTOSIZE);
    imshow("image", src);
    waitKey(0);
    return 0;
}

如果出现dll文件丢失,可以注销账户或者重启电脑是环境变量生效。

PS: 按照上述方法做的时候,在debug和release界面的附加依赖项里其中一个编辑完,另一个为什么也出现了和其一样的附加依赖项?怎么实现debug和release中的附加依赖项不一样?? 哪位大侠知道解决方法,求告知!!!!!

参考方案:
每次编写代码在前面加入下面的代码,可以不用配置编辑附加依赖项
参考来源:http://blog.csdn.net/xiaohuh421/article/details/7476485

#ifdef _DEBUG
#pragma comment(lib,"..\\debug\\LedCtrlBoard.lib")
#else
#pragma comment(lib,"..\\release\\LedCtrlBoard.lib")
#endif

#ifdef _DEBUG
#pragma comment(lib, "opencv_calib3d2410d.lib")
#pragma comment(lib, "opencv_contrib2410d.lib")
#pragma comment(lib, "opencv_core2410d.lib")
#pragma comment(lib, "opencv_features2d2410d.lib")
#pragma comment(lib, "opencv_flann2410d.lib")
#pragma comment(lib, "opencv_gpu2410d.lib")
#pragma comment(lib, "opencv_highgui2410d.lib")
#pragma comment(lib, "opencv_imgproc2410d.lib")
#pragma comment(lib, "opencv_legacy2410d.lib")
#pragma comment(lib, "opencv_ml2410d.lib")
#pragma comment(lib, "opencv_nonfree2410d.lib")
#pragma comment(lib, "opencv_objdetect2410d.lib")
#pragma comment(lib, "opencv_photo2410d.lib")
#pragma comment(lib, "opencv_stitching2410d.lib")
#pragma comment(lib, "opencv_ts2410d.lib")
#pragma comment(lib, "opencv_video2410d.lib")
#pragma comment(lib, "opencv_videostab2410d.lib")
#else
#pragma comment(lib, "opencv_calib3d2410.lib")
#pragma comment(lib, "opencv_contrib2410.lib")
#pragma comment(lib, "opencv_core2410.lib")
#pragma comment(lib, "opencv_features2d2410.lib")
#pragma comment(lib, "opencv_flann2410.lib")
#pragma comment(lib, "opencv_gpu2410.lib")
#pragma comment(lib, "opencv_highgui2410.lib")
#pragma comment(lib, "opencv_imgproc2410.lib")
#pragma comment(lib, "opencv_legacy2410.lib")
#pragma comment(lib, "opencv_ml2410.lib")
#pragma comment(lib, "opencv_nonfree2410.lib")
#pragma comment(lib, "opencv_objdetect2410.lib")
#pragma comment(lib, "opencv_photo2410.lib")
#pragma comment(lib, "opencv_stitching2410.lib")
#pragma comment(lib, "opencv_ts2410.lib")
#pragma comment(lib, "opencv_video2410.lib")
#pragma comment(lib, "opencv_videostab2410.lib")
#endif

如果觉得每次添加比较麻烦,可以采用如下一劳永逸的方案:

新建一个opencv_lib.h文件,编辑内容:

#ifndef _OPENCV_LIB_
#define _OPENCV_LIB_

#ifdef _DEBUG
#pragma comment(lib, "opencv_calib3d2410d.lib")
#pragma comment(lib, "opencv_contrib2410d.lib")
#pragma comment(lib, "opencv_core2410d.lib")
#pragma comment(lib, "opencv_features2d2410d.lib")
#pragma comment(lib, "opencv_flann2410d.lib")
#pragma comment(lib, "opencv_gpu2410d.lib")
#pragma comment(lib, "opencv_highgui2410d.lib")
#pragma comment(lib, "opencv_imgproc2410d.lib")
#pragma comment(lib, "opencv_legacy2410d.lib")
#pragma comment(lib, "opencv_ml2410d.lib")
#pragma comment(lib, "opencv_nonfree2410d.lib")
#pragma comment(lib, "opencv_objdetect2410d.lib")
#pragma comment(lib, "opencv_photo2410d.lib")
#pragma comment(lib, "opencv_stitching2410d.lib")
#pragma comment(lib, "opencv_ts2410d.lib")
#pragma comment(lib, "opencv_video2410d.lib")
#pragma comment(lib, "opencv_videostab2410d.lib")
#else
#pragma comment(lib, "opencv_calib3d2410.lib")
#pragma comment(lib, "opencv_contrib2410.lib")
#pragma comment(lib, "opencv_core2410.lib")
#pragma comment(lib, "opencv_features2d2410.lib")
#pragma comment(lib, "opencv_flann2410.lib")
#pragma comment(lib, "opencv_gpu2410.lib")
#pragma comment(lib, "opencv_highgui2410.lib")
#pragma comment(lib, "opencv_imgproc2410.lib")
#pragma comment(lib, "opencv_legacy2410.lib")
#pragma comment(lib, "opencv_ml2410.lib")
#pragma comment(lib, "opencv_nonfree2410.lib")
#pragma comment(lib, "opencv_objdetect2410.lib")
#pragma comment(lib, "opencv_photo2410.lib")
#pragma comment(lib, "opencv_stitching2410.lib")
#pragma comment(lib, "opencv_ts2410.lib")
#pragma comment(lib, "opencv_video2410.lib")
#pragma comment(lib, "opencv_videostab2410.lib")
#endif

#endif

将该文件放入opencv的安装目录:C:\Adisk\software\opencv\opencv2410\opencv\build\include\opencv2\opencv_lib.h也就是和 #include <opencv2/opencv.hpp>在同一个目录,之后只需要包含头文件 #include <opencv2/opencv_lib.h>

就可以在Debug和Release版本之间任意切换

VS2013安装oepncv2.4.10 以及opencv 3.0.0的更多相关文章

  1. 32和64位的CentOS 6.0下 安装 Mono 2.10.8 和Jexus 5.0

    http://www.cnblogs.com/shanyou/archive/2012/01/07/2315982.html shanyou 博客

  2. VS2013下配置OpenCV 3.0.0 &&& VS2013下配置Opencv2.4.9

    最近做图像需要用到Matlab和OpenCV,一些东西真的是要深入的研究进去才会有所发现,但Matlab和C++都不是我擅长的语言,所以要很加油很加油才行啊!! 步入正题. 1.  环境:Win7 6 ...

  3. 深度学习框架-caffe安装-Mac OSX 10.12

    p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px ".PingFang SC"; color: #454545 } p.p2 ...

  4. 水晶报表Win10(64bit)VS2013安装成功

    windows 10 64 VS2013安装 CR For VS 13_0_18 安装过程没有报错 安装成功http://downloads.businessobjects.com/akdlm/cr4 ...

  5. 安装笔记, caffe 、 opencv等

    1. 1.1 opencv static linux mkdir build & cd build cmake .. -LH  这句话用来查看编译选项  如果不知道编译啥  可以用这个查看一下 ...

  6. 在Jetson TX2上安装OpenCV(3.4.0)

    参考文章:How to Install OpenCV (3.4.0) on Jetson TX2 与参考文章大部分都是相似的,如果不习惯看英文,可以看看我下面的描述 在我们使用python3进行编程时 ...

  7. CentOS安装MySQL-5.6.10+安全配置

    注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. #准备工作# 在安装MySQL之前,请确保已经使用yum安装了各类基础组件,具体见<CentOS安装LNMP环境的基础组件& ...

  8. Centos7 编译安装 Nginx PHP Mariadb Memcached 扩展 ZendOpcache扩展 (实测 笔记 Centos 7.3 + Mariadb 10.1.20 + Nginx 1.10.2 + PHP 7.1.0 + Laravel 5.3 )

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...

  9. Windows下 VM12虚拟机安装OS X 10.11 和VM TOOLS

    Windows下虚拟机安装Mac OS X —– VMware Workstation12安装Mac OS X 10.11 本文即将介绍WIN虚拟MAC的教程.完整详细教程(包含安装中的一些问题) [ ...

随机推荐

  1. sharepoint2010匿名访问

    怎样在SharePoint 2010网站中启用匿名访问 SharePoint 2010的改动比较大,尤其是相对SharePoint Portal Server 2003来说.本文介绍在SharePoi ...

  2. 【leetcode】Unique Binary Search Trees II

    Unique Binary Search Trees II Given n, generate all structurally unique BST's (binary search trees) ...

  3. oracle11g 连接问题

    一.The Network Adapter could not establish the connection  状态: 失败 -测试失败: IO 错误: The Network Adapter c ...

  4. fastReport 运行时设计报表 (mtm)

    设计报表 通过“TfrxReport.DesignReport”方法调用报表设计器.你必须在你的项目中包含报表设计器 (必要条件是:要么使用“TfrxDesigner”组件,要么增加“frxDesgn ...

  5. 5. javacript高级程序设计-引用类型

    1. 引用类型 1.1 Object类型 创建Object类型有两种方式: 使用new操作符后跟Object构造函数 var person =new Object(); 字符量表示法 var pers ...

  6. vs版本转换工具

      [转]C#写的工程项目移植转换工具 – 支持VS2005/VS2010/VS2012/VS2013 经常用Visual Studio开发项目的是不是会经常遇到下面这种情况或者类似于这样的情况?用新 ...

  7. Django~urls.py--->views.py

    The 'r' in front of each regular expression string is optional but recommended. It tells Python that ...

  8. Django~学习计划

    20160302 Excel,PDF 处理 GeoDjango学习:GIS编程,百度地图 Javascript 邮件系统 图像处理

  9. 【python】classmethod & staticmethod 区别

    来源:http://blog.csdn.net/carolzhang8406/article/details/6856817 其他参考: http://blog.csdn.net/lovingprin ...

  10. 60. Permutation Sequence

    题目: The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of t ...