win7+vs2008+opencv
1、下载安装VS2008,然后直接下载opencv的windows的安装版,
2、把opencv解压出来,我的路径为:D:\Program\opencv
3、配置PATH:电脑--属性--高级系统设置--环境变量--用户变量/系统变量;找到PATH,点编辑,在最后面添加
;D:\Program\opencv\build\x86\vc9\bin
4、打开VS2008,配置opencv头文件和lib库目录;
工具--选项--项目和解决方案--VC++目录
5、每次在新建一个项目后,都需要配置lib库;
项目属性--通用配置--连接器--输入
DEBUG:
opencv_calib3d246d.lib opencv_contrib246d.lib opencv_core246d.lib opencv_features2d246d.lib opencv_flann246d.lib opencv_gpu246d.lib opencv_haartraining_engined.lib opencv_highgui246d.lib opencv_imgproc246d.lib opencv_legacy246d.lib opencv_ml246d.lib opencv_nonfree246d.lib opencv_objdetect246d.lib opencv_photo246d.lib opencv_stitching246d.lib opencv_superres246d.lib opencv_ts246d.lib opencv_video246d.lib opencv_videostab246d.lib
Release
opencv_calib3d246.lib opencv_contrib246.lib opencv_core246.lib opencv_features2d246.lib opencv_flann246.lib opencv_gpu246.lib opencv_haartraining_engine.lib opencv_highgui246.lib opencv_imgproc246.lib opencv_legacy246.lib opencv_ml246.lib opencv_nonfree246.lib opencv_objdetect246.lib opencv_photo246.lib opencv_stitching246.lib opencv_superres246.lib opencv_ts246.lib opencv_video246.lib opencv_videostab246.lib
6、书写一个测试程序:
//读取图片 #include <iostream> #include <string> #include "cv.h" #include "highgui.h" using namespace std; void ReadShowImage() { IplImage *img=cvLoadImage("pp.jpg"); cvNamedWindow("测试",CV_WINDOW_AUTOSIZE); cvShowImage("测试",img); cvWaitKey(0); cvReleaseImage(&img); cvDestroyWindow("测试"); } int main() { ReadShowImage(); return 0; }
运行显示出来,opencv配置完成。