1. 下载并安装OpenCV,解压地址假设在D盘,会自动在D盘中创建opencv文件夹
2. 设置环境变量
打开cmd窗口,输入后回车
setx -m OPENCV_DIR D:\openCV\build\x86\vc10
%OPENCV_DIR%\bin
3.修改VS2010相关设置
$(OPENCV_DIR)\..\..\include
$(OPENCV_DIR)\lib
opencv_core248d.lib
opencv_imgproc248d.lib
opencv_highgui248d.lib
opencv_video248d.lib
opencv_core248.lib
opencv_imgproc248.lib
opencv_highgui248.lib
opencv_video248.lib
4. 编写测试程序,验证OpenCV正确安装(注:将图像pp.bmp放在程序源代码文件夹下)
#include <opencv2\opencv.hpp> #include <iostream> using namespace cv; using namespace std; int main(int argc, char** argv) { Mat image; image = imread("pp.bmp",IMREAD_COLOR); if(! image.data) { cout << "Could not open or find the image" <<endl; return -1; } namedWindow( "Display window",WINDOW_AUTOSIZE); imshow( "Display window",image); waitKey(0); return 0; }
win7系统vs2010中安装使用预编译的OpenCV2.4.8库,布布扣,bubuko.com
win7系统vs2010中安装使用预编译的OpenCV2.4.8库
原文:http://www.cnblogs.com/alizzwell/p/3621224.html