1、下载vs2013,网址:http://download.microsoft.com/download/9/3/E/93EA27FF-DB02-4822-8771-DCA0238957E9/vs2013.5_ult_chs.iso?type=ISO;
2、安装:选自定义安装,看自己需求;
3、下载OpenCV,网址:https://nchc.dl.sourceforge.net/project/opencvlibrary/opencv-win/2.4.12/opencv-2.4.12.exe;
4、安装:双击运行解压,(VS2013用的是vc12,VS2012用的是vc11);
5、环境变量配置:在path添加:D:\opencv\build\x64\vc12\bin;D:\opencv\build\x86\vc12\bin;
添加这两个的作用是编程序时可能会选择在Win32平台下运行,也可能会选择在x64下运行,添加两个以后可方便切换平台;
6、在vs2013配置OpenCV:
(1)在项目中配置包含目录:D:\opencv\build\include\opencv2、D:\opencv\build\include\opencv、D:\opencv\build\include;
(2)配置库目录:
D:\opencv\build\x86\vc12\lib
D:\opencv\build\x86\vc12\staticlib
D:\opencv\build\x64\vc12\lib
D:\opencv\build\x64\vc12\staticlib
其他库,如:C:\Program Files\Daheng Imavision\MER-Series\Samples\VC SDK\lib\x86、D:\myimage\zmc;
(3)链接器的输入(注意对应版本2412d):
opencv_calib3d2412d.lib
opencv_contrib2412d.lib
opencv_core2412d.lib
opencv_features2d2412d.lib
opencv_flann2412d.lib
opencv_gpu2412d.lib
opencv_highgui2412d.lib
opencv_imgproc2412d.lib
opencv_legacy2412d.lib
opencv_ml2412d.lib
opencv_nonfree2412d.lib
opencv_objdetect2412d.lib
opencv_ocl2412d.lib
opencv_photo2412d.lib
opencv_stitching2412d.lib
opencv_superres2412d.lib
opencv_ts2412d.lib
opencv_video2412d.lib
opencv_videostab2412d.lib
PS:参考下面的文章
https://blog.csdn.net/lhanchao/article/details/51863975
https://blog.csdn.net/terrenceyuu/article/details/78265515
http://www.cnblogs.com/sdya/p/5336802.html
完毕。