opencv2.4.13怎么配置环境变量
step1:安装,选择你所想安装到的位置
step2:配置环境变量
1、给系统变量配置path:添加:D:\opencv2_4_13\opencv\build\x86\vc12\bin
2、给用户变量添加opencv变量,值D:\opencv2_4_13\opencv\build
添加PATH变量(有就不需要添加,但是值需要添加)值D:\opencv2_4_13\opencv\build\x86\vc12\bin
说明:不管你系统是32位还是64位,路径目录均选择X86,因为编译都是使用32位编译;如果选用X64,则程序运行时候会出错。
属性管理器:
注意:debug和release都要配置
1、debug:
1)VC++目录->包含目录
添加
D:\opencv2_4_13\opencv\build\include
D:\opencv2_4_13\opencv\build\include\opencv
D:\opencv2_4_13\opencv\build\include\opencv2
2)VC++目录->库目录
添加:
D:\opencv2_4_13\opencv\build\x86\vc12\lib
3)链接器->输入->附加依赖项
添加:
opencv_ml2413d.lib
opencv_calib3d2413d.lib
opencv_contrib2413d.lib
opencv_core2413d.lib
opencv_features2d2413d.lib
opencv_flann2413d.lib
opencv_gpu2413d.lib
opencv_highgui2413d.lib
opencv_imgproc2413d.lib
opencv_legacy2413d.lib
opencv_objdetect2413d.lib
opencv_ts2413d.lib
opencv_video2413d.lib
opencv_nonfree2413d.lib
opencv_ocl2413d.lib
opencv_photo2413d.lib
opencv_stitching2413d.lib
opencv_superres2413d.lib
opencv_videostab2413d.lib
2、Release
1)、2)与debug版本一样
3)添加:
opencv_objdetect2413.lib
opencv_ts2413.lib
opencv_video2413.lib
opencv_nonfree2413.lib
opencv_ocl2413.lib
opencv_photo2413.lib
opencv_stitching2413.lib
opencv_superres2413.lib
opencv_videostab2413.lib
opencv_calib3d2413.lib
opencv_contrib2413.lib
opencv_core2413.lib
opencv_features2d2413.lib
opencv_flann2413.lib
opencv_gpu2413.lib
opencv_highgui2413.lib
opencv_imgproc2413.lib
opencv_legacy2413.lib
opencv_ml2413.lib
测试
添加新建项test.cpp
输入代码:
#include <cv.h>
#include <highgui.h>
using namespace std;
int main()
{
IplImage * test;
test = cvLoadImage("D:\\Sample_8.bmp");//图片路径
cvNamedWindow("test_demo", 1);
cvShowImage("test_demo", test);
cvWaitKey(0);
cvDestroyWindow("test_demo");
cvReleaseImage(&test);
return 0;
}