VS2008配置opencv

配置过程:

1 需要先提前安装好VS2008并下载好opencv的库

2 配置Windows环境变量:

具体步骤为:

右键我的电脑->属性->详细设定标签里->环境变量->系统变量,找到Path;将D:\Program Files\opencv2.4.5\build\x86\vc9\bin加入到系统环境变量Path中。


3 为VS2008 配置openCV环境:
(1)打开VS 2008,菜单 工具-> 选项 -> 项目和解决方案-> VC++ 目录
(2)在 显示以下内容的目录中,选择包含文件,加入目录
D:\Program Files\opencv2.4.4\build\include
D:\Program Files\opencv2.4.4\build\include\opencv
D:\Program Files\opencv2.4.4\build\include\opencv2
(3)在 显示以下内容的目录中,选择 库文件,加入目录
D:\Program Files\opencv2.4.4\build\x86\vc9\lib


4 具体OpenCV工程配置或者代码:
(1)打开VS 2008,创建一个Win32控制台程序,项目名为Test;
(2)选择  解决方案里的Test项目,点击鼠标右键,选择Properties,选择Linker中Input(调试目录)。
(3)在Additional Dependencies 中添加如下目录:
opencv_calib3d244d.lib
opencv_contrib244d.lib
opencv_core244d.lib
opencv_features2d244d.lib
opencv_flann244d.lib
opencv_gpu244d.lib
opencv_highgui244d.lib
opencv_imgproc244d.lib
opencv_legacy244d.lib
opencv_ml244d.lib
opencv_nonfree244d.lib
opencv_objdetect244d.lib
opencv_photo244d.lib
opencv_stitching244d.lib
opencv_ts244d.lib
opencv_video244d.lib
opencv_videostab244d.lib
opencv_calib3d244.lib
opencv_contrib244.lib
opencv_core244.lib
opencv_features2d244.lib
opencv_flann244.lib
opencv_gpu244.lib
opencv_highgui244.lib
opencv_imgproc244.lib
opencv_legacy244.lib
opencv_ml244.lib
opencv_nonfree244.lib
opencv_objdetect244.lib
opencv_photo244.lib
opencv_stitching244.lib
opencv_ts244.lib
opencv_video244.lib
opencv_videostab244.lib

5 测试工程代码如下:

#include <stdio.h>
#include <stdlib.h>
#include <cv.h>
#include <highgui.h>
using namespace cv;
void main()
{
	 IplImage *img = cvLoadImage("E:/1.png");      
     cvNamedWindow("Image:",CV_WINDOW_AUTOSIZE);
     cvShowImage("Image:",img);
     cvWaitKey(0);
     cvDestroyWindow("Image:");
     cvReleaseImage(&img);
	 system("pause");
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值