VS2010下配置 OpenCV2.2
下载OpenCV2.2 安装
我的安装路径是D:\Program Files\OpenCV2.2
打开VS2010
新建项目HelloOpencv
在中 单击
打开
打开
分别在包含目录加入
D:\Program Files\OpenCV2.2\include
D:\Program Files\OpenCV2.2\include\opencv
在库目录加入
D:\Program Files\OpenCV2.2\lib
单击应用
选择 连接器-->输入
在附加依赖项中 增加所要包含的库就行了
opencv_core220d.lib
opencv_highgui220d.lib
opencv_video220d.lib
opencv_ml220d.lib
opencv_legacy220d.lib
opencv_imgproc220d.lib
opencv_highgui220d.lib
opencv_video220d.lib
opencv_ml220d.lib
opencv_legacy220d.lib
opencv_imgproc220d.lib
点击应用 确定
下面可以试一下是不是配置成功
输入代码:
#include "stdafx.h"
#include "cv.h"
#include <cxcore.h>
#include <highgui.h>
int _tmain(int argc, _TCHAR* argv[])
{
IplImage *img = cvLoadImage("funny-pictures.jpg");
cvNamedWindow("Image:",1);
cvShowImage("Image:",img);
cvWaitKey();
cvDestroyWindow("Image:");
cvReleaseImage(&img);
return 0;
}
#include "cv.h"
#include <cxcore.h>
#include <highgui.h>
int _tmain(int argc, _TCHAR* argv[])
{
IplImage *img = cvLoadImage("funny-pictures.jpg");
cvNamedWindow("Image:",1);
cvShowImage("Image:",img);
cvWaitKey();
cvDestroyWindow("Image:");
cvReleaseImage(&img);
return 0;
}
将图片 funny-pictures.jpg 放在[VS2010默认项目文件夹]\HelloOpenCV\HelloOpenCV 下
运行结果