OpenCV2学习笔记02:MSVC2013搭建OpenCV开发环境
我这里编译的库是通过手动编译的。只是需要注意的是,手动编译一般会产生大量的文件,差不多7个多G的样子,实在是有点浪费硬盘存储呀,其实我们可以删除掉没有用的东西。因为我们在编译的时候指定了一个目录比如我设定的/build/vs2013,所有的文件都会在vs2013文件夹下生成,而唯一对我们有用的就是最终生成的install文件夹,除了这个文件夹的内容之外,其他的文件可以全部删除。去掉那些无用的文件之后,磁盘瞬间轻松了许多,有图有真相。
1. 首先设置系统的环境变量:
D:\3rdPartLib\opencv-2.4.9\build\vs2013\install\x64\vc12\bin
2. 指定“可执行文件目录”,不区分Debug和Release模式:
D:\3rdPartLib\opencv-2.4.9\build\vs2013\install\x64\vc12\bin
3. 指定包含“文件目录”路径,不区分Debug和Release模式:
D:\3rdPartLib\opencv-2.4.9\build\vs2013\install\include
4. 指定“库目录”,Debug和Release模式设置相同:
D:\3rdPartLib\opencv-2.4.9\build\vs2013\install\x64\vc12\lib
5. 比较麻烦的就是添加“附加依赖项”了,
Debug模式下的依赖项:
opencv_videostab249d.lib;
opencv_video249d.lib;
opencv_ts249d.lib;
opencv_superres249d.lib;
opencv_stitching249d.lib;
opencv_photo249d.lib;
opencv_ocl249d.lib;
opencv_objdetect249d.lib;
opencv_nonfree249d.lib;
opencv_ml249d.lib;
opencv_legacy249d.lib;
opencv_imgproc249d.lib;
opencv_highgui249d.lib;
opencv_gpu249d.lib;
opencv_flann249d.lib;
opencv_features2d249d.lib;
opencv_core249d.lib;
opencv_contrib249d.lib;
opencv_calib3d249d.lib;
而Release模式与Debug模式的区别是库文件后面少了一个符号"d",如下:
opencv_videostab249.lib;
opencv_video249.lib;
opencv_ts249.lib;
opencv_superres249.lib;
opencv_stitching249.lib;
opencv_photo249.lib;
opencv_ocl249.lib;
opencv_objdetect249.lib;
opencv_nonfree249.lib;
opencv_ml249.lib;
opencv_legacy249.lib;
opencv_imgproc249.lib;
opencv_highgui249.lib;
opencv_gpu249.lib;
opencv_flann249.lib;
opencv_features2d249.lib;
opencv_core249.lib;
opencv_contrib249.lib;
opencv_calib3d249.lib;
注意:如果在编译过程中修改了以上这些参数,请一定要重新启动开发环境,否则可能报错。