1.下载OPENCV2.4.3:http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.3/
2.解压缩
3.添加环境变量
PATH中添加:D:\software\opencv243\build\x86\vc10\bin;
D:\software\opencv243为你解压缩的目录
4.启动VS2010
新建WIN32工程,此处可参考
http://docs.opencv.org/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html#windows-visual-studio-how-to
5.在项目的属性管理器中,新建属性表,例如图中起名OpenCV_Debug
在你新建的项目表上右键单击属性
找到‘C/C++ -- 常规 ’附加包含目录中添加
在‘连接器--常规--附加库目录’下添加
在‘连接器--输入--附加依赖项’添加所需的库文件
以下是全部
opencv_calib3d243d.lib
opencv_core243d.lib
opencv_imgproc243d.lib
opencv_highgui243d.lib
opencv_ml243d.lib
opencv_video243d.lib
opencv_features2d243d.lib
opencv_calib3d243d.lib
opencv_objdetect243d.lib
opencv_contrib243d.lib
opencv_legacy243d.lib
opencv_flann243d.lib
opencv_gpu243d.lib
opencv_haartraining_engined.lib
opencv_nonfree243d.lib
opencv_photo243d.lib
opencv_stitching243d.lib
opencv_ts243d.lib
opencv_videostab243d.lib
重复第5部,只不过在RELEASE下新建OpenCV_Release
注意其中附加依赖项添加的问价为下列库,与上面相比文件名结尾少了‘d’
opencv_core231.lib
opencv_imgproc231.lib
opencv_highgui231.lib
opencv_ml231.lib
opencv_video231.lib
opencv_features2d231.lib
opencv_calib3d231.lib
opencv_objdetect231.lib
opencv_contrib231.lib
opencv_legacy231.lib
opencv_flann231.lib
6. 保存OpenCV_Release和OpenCV_Debug在你的新工程里加进他们即可
参考
http://docs.opencv.org/doc/tutorials/introduction/windows_install/windows_install.html#windowssetpathandenviromentvariable
http://docs.opencv.org/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html#windows-visual-studio-how-to
http://www.cnblogs.com/tornadomeet/archive/2012/11/07/2759476.html