vs2013+opencv2.4.10配置
最近忙忙碌碌也不知道干了些啥,自己编程技术又这么菜,还是努力至上吧。
(1)下载及安装:
VS2013:cn_visual_studio_ultimate_2013_with_update_5_x86_dvd_6816649.iso,太大了上传不了网盘,自行下载
opencv2.4.10:http://opencv.org/,官网自行下载
可以自行选择解压地址,但是要自己知道,最好文件夹命名一目了然。
(2)环境配置
右击我的电脑---属性----高级系统设置---高级----环境变量
1.添加opencv,D:\软件下载\opencv2.4.10\opencv\build
2.添加PATH:D:\软件下载\opencv2.4.10\opencv\build\x86\vc12\bin
3.添加系统变量Path:D:\软件下载\opencv2.4.10\opencv\build\x86\vc12\bin
以上环境需重启后生效
(3)新建VS
如上图选择。
右键项目属性,VC++目录---包含目录
VC++目录---库目录
链接器---输入
debug模式:
opencv_ml2410d.lib
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_objdetect2410d.lib
opencv_ts2410d.lib
opencv_video2410d.lib
opencv_nonfree2410d.lib
opencv_ocl2410d.lib
opencv_photo2410d.lib
opencv_stitching2410d.lib
opencv_superres2410d.lib
opencv_videostab2410d.lib
release模式:
opencv_objdetect2410.lib
opencv_ts2410.lib
opencv_video2410.lib
opencv_nonfree2410.lib
opencv_ocl2410.lib
opencv_photo2410.lib
opencv_stitching2410.lib
opencv_superres2410.lib
opencv_videostab2410.lib
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
两者的区别就是有d无d。
(4)测试
#include <opencv2\opencv.hpp>
#include <iostream>
#include <string>
using namespace cv;
using namespace std;
int main()
{
Mat img = imread("D:\\baboon.jpg");
if (img.empty())
{
cout << "error";
return -1;
}
imshow("照片显示", img);
waitKey();
return 0;
}