VS2010配置OpenCV2.4.10并显示图像
一、下载OpenCV
此次版本是VS2010和OpenCV2.4.10。
下载地址:OpenCV下载地址【注意:不同版本VS适配不同版本的OpenCV】
二、解压
我的解压位置是D:\Microsoft
三、配置环境
右击电脑-属性-高级系统设置-高级-环境变量-系统变量-Path添加如下路径:
D:\Microsoft\opencv\build\x64\vc10\bin;
D:\Microsoft\opencv\build\x86\vc10\bin
四、工程配置
1.新建工程,右击项目-属性
2.配置属性-VC++目录-包含目录,添加如下路径:
D:\Microsoft\opencv\build\include
D:\Microsoft\opencv\build\include\opencv
D:\Microsoft\opencv\build\include\opencv2
3.配置属性-VC++目录-库目录,添加如下路径:
D:\Microsoft\opencv\build\x86\vc10\lib【注意:x86或者x64根据配置需要,vc10代表VS2010】
4.配置属性-链接器-输入-附加依赖项,添加如下内容:
opencv_calib3d2410d.lib
opencv_contrib2410d.lib
opencv_core2410d.lib
opencv_features2d2410d.lib
opencv_flann2410d.lib
opencv_gpu2410d.lib
opencv_highgui2410d.lib
opencv_imgproc2410d.lib
opencv_legacy2410d.lib
opencv_ml2410d.lib
opencv_nonfree2410d.lib
opencv_objdetect2410d.lib
opencv_ocl2410d.lib
opencv_photo2410d.lib
opencv_stitching2410d.lib
opencv_superres2410d.lib
opencv_video2410d.lib
opencv_videostab2410d.lib
opencv_calib3d2410.lib
opencv_contrib2410.lib
opencv_core2410.lib
opencv_features2d2410.lib
opencv_flann2410.lib
opencv_gpu2410.lib
opencv_highgui2410.lib
opencv_imgproc2410.lib
opencv_legacy2410.lib
opencv_ml2410.lib
opencv_nonfree2410.lib
opencv_objdetect2410.lib
opencv_ocl2410.lib
opencv_photo2410.lib
opencv_stitching2410.lib
opencv_superres2410.lib
opencv_ts2410.lib
opencv_video2410.lib
opencv_videostab2410.lib
以上为D:\Microsoft\opencv\build\x86\vc10\lib目录下的库文件,其中d结尾的为debug模式库,其余没有d结尾的为release模式库。
五、测试
源文件添加代码进行测试。