版权声明:本文为博主原创文章,未经博主允许不得转载。
目录(?)[-]
参考博客如下所示:
博客链接:http://blog.csdn.NET/cv_jason/article/details/70037545
下面的博客配置有点小问题,不过思路和过程是对的,非常好!
最近才知道,在OpenCV3.0 之后,OpenCV算法包被拆分成两部分,官方发布的OpenCV包只包含最基础最稳定的部分,而某些图像处理的经典算法如SIFT和SURF等被封装到opencv_contrib中。如果想要使用这些包,还需要自己另外编译。这些天看了好多帖子,终于把这件事做成了,现在梳理一下。
opencv3.2 源文件下载链接:https://github.com/opencv/opencv
opencv_contirb 源文件下载链接:https://github.com/opencv/opencv_contrib
cmake下载链接:https://cmake.org/files/v3.8/cmake-3.8.0-rc4-win64-x64.msi
注意事项
下载完opencv之后,直接解压即可,在GitHub下载的解压包,都有master的后缀
安装Cmake的过程比较简单,不再介绍,这里直接讲Cmake的使用
注意,两个路径中,都不能有中文或者空格(最常见的Program Files文件夹也不行),否则容易出错
注意,如果想要生成32位的,选择Visual Studio 12 2013 的选项
生成过程比较漫长,因为要下载几个文件
这几个文件的服务器都在国外,因此,可能有下载失败的情况,如果失败,那么可以手动下载然后补充在提示的文件夹即可
生成完之后长这样
配置 opencv_ contrib的路径,在OPENCV_EXTRA_MODULES_PATH 的属性下配置路径,我这里是
D:\Personal\Desktop\opencv_contrib-master\modules
注意,一定是modules文件夹的路径
配置玩之后,点击Generate,生成的结果如下:
然后直接Open Project即可
至此,Visual Studio2013打开,Cmake的任务完成,可以关掉了。
打开VS之后,可以看到完整的OpenCV3.2 项目,我这里有120项,但有的教程是114,不同的原因在于电脑上装了MatLab或CUDA等其他图形图像处理的软件,这些在之前的Cmake里面都可以设置,如果你知道自己要干什么,可自行设置,如果不懂,还是别乱动了。
然后直接编译即可了,这个过程比较慢,我I5 2450U 3.0GHz的处理器,大概跑了10分钟
最后结果
在CMakeTargets中找到INSTALL,然后生成INSTALL,得到我们想要的最终文件
最后,在我们的目标生成文件tools中查看最后的结果
只有install是我们需要的结果,其余可以全删掉
是不是很熟悉?
选择Release版,可以生成对应文件,操作步骤与debug相同
如果需要32位,则需要返回到CMake重新配置编译器
由于debug和release文件最后都放在了一起,因此在配置的时候不能用*.lib的格式,具体文件列表如下:
debug版
opencv_aruco320d.lib
opencv_bgsegm320.lib
opencv_bioinspired320d.lib
opencv_calib3d320d.lib
opencv_ccalib320d.lib
opencv_core320d.lib
opencv_datasets320d.lib
opencv_dpm320d.lib
opencv_face320d.lib
opencv_features2d320d.lib
opencv_flann320d.lib
opencv_fuzzy320d.lib
opencv_imgcodecs320d.lib
opencv_imgproc320d.lib
opencv_highgui320d.lib
opencv_line_descriptor320d.lib
opencv_ml320d.lib
opencv_objdetect320d.lib
opencv_optflow320d.lib
opencv_phase_unwrapping320d.lib
opencv_photo320d.lib
opencv_plot320d.lib
opencv_reg320d.lib
opencv_rgbd320d.lib
opencv_saliency320d.lib
opencv_shape320d.lib
opencv_stereo320d.lib
opencv_stitching320d.lib
opencv_structured_light320d.lib
opencv_superres320d.lib
opencv_surface_matching320d.lib
opencv_text320d.lib
opencv_tracking320d.lib
opencv_video320d.lib
opencv_videoio320d.lib
opencv_videostab320d.lib
opencv_xfeatures2d320d.lib
opencv_ximgproc320d.lib
opencv_xobjdetect320d.lib
opencv_xphoto320d.lib
release版
opencv_aruco320.lib
opencv_bgsegm320.lib
opencv_bioinspired320.lib
opencv_calib3d320.lib
opencv_ccalib320.lib
opencv_core320.lib
opencv_datasets320.lib
opencv_dpm320.lib
opencv_face320.lib
opencv_features2d320.lib
opencv_flann320.lib
opencv_fuzzy320.lib
opencv_highgui320.lib
opencv_imgcodecs320.lib
opencv_imgproc320.lib
opencv_line_descriptor320.lib
opencv_ml320.lib
opencv_objdetect320.lib
opencv_optflow320.lib
opencv_phase_unwrapping320.lib
opencv_photo320.lib
opencv_plot320.lib
opencv_reg320.lib
opencv_rgbd320.lib
opencv_saliency320.lib
opencv_shape320.lib
opencv_stereo320.lib
opencv_stitching320.lib
opencv_structured_light320.lib
opencv_superres320.lib
opencv_surface_matching320.lib
opencv_text320.lib
opencv_tracking320.lib
opencv_video320.lib
opencv_videoio320.lib
opencv_videostab320.lib
opencv_xfeatures2d320.lib
opencv_ximgproc320.lib
opencv_xobjdetect320.lib
opencv_xphoto320.lib