vs2013+opencv249下载及配置:
open300配置简单,但是不能使用sift等若干算法,其中sift,surf等在300中被归为contrib库中。在opencv官网下载opencv300版本不包含contrib库,需要独立下载。contrib库需要使用cmake进行编译及若干配置且不可靠。暂时没有找到更好的方法解决。故使用249版本。可按照正常配置流程进行配置。(使用sift时注意include nonfree等头文件)
1.下载:在官网:http://opencv.org/上找到OpenCV windows版下载下来(稍后放云盘链接)。
2.配置环境变量:【计算机】->【(右键)属性】->【高级系统设置】->【高级(标签)】->【环境变量】->“双击”系统变量中的PATH->在变量值里面添加相应的路径。
对于32位系统,就添加:
”;…… opencv\build\x86\vc12\bin”(和之前的就有有的环境变量用英文的分号“;”进行分隔)
而对于64位系统,可以两个都添加上:
”;…… opencv\build\x86\vc12\bin”
和”…… opencv\build\x64\vc12\bin”
3.vs2013配置:
vc12->2013;
vc11->2012;
项目->属性管理器;
VC++目录:
可执行文件目录:
E:\opencv\build\x86\vc12\bin
包含目录:
E:\opencv\build\include\opencv
E:\opencv\build\include\opencv2
E:\opencv\build\include
库目录:
E:\opencv\build\x86\vc12\lib
E:\opencv\build\x86\vc12\staticlib
链接器->输入->附加依赖项:
opencv2.4.9的库:
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_objdetect249d.lib
opencv_ts249d.lib
opencv_video249d.lib
opencv_nonfree249d.lib
opencv_ocl249d.lib
opencv_photo249d.lib
opencv_stitching249d.lib
opencv_superres249d.lib
opencv_videostab249d.lib
opencv_objdetect249.lib
opencv_ts249.lib
opencv_video249.lib
opencv_nonfree249.lib
opencv_ocl249.lib
opencv_photo249.lib
opencv_stitching249.lib
opencv_superres249.lib
opencv_videostab249.lib
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
4.将E:\Program Files\opencv\opencv\build\x86\vc12\bin中dll加入c:\Windows\System32中。(预防若干问题)windows8是SysWOW64。
测试程序:读取一幅图片:
#include<iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main()
{
Mat img=imread("tupain.jpg");
namedWindow("aaa");
imshow("aaa",img);
waitKey(2000);
}