淘先锋技术网

首页 1 2 3 4 5 6 7

参考CSDN文章https://blog.csdn.net/qq_15947787/article/details/78534272

参考简书文章https://www.jianshu.com/p/5520fdb6dbae?from=singlemessage

此文作者说 通过查看cuda官方手册,目前Cuda支持的VS工具集只有15.0和15.6,但是新下载的VS2017一般都是15.7,因此会出现无法编译的情况


VS2017最新版和CUDA坑爹的兼容性,试了好多次都失败了 ,以下配置为vs2017下的截图 但在vs2015步骤完全一样。

走了一天的坑,最后放弃了使用vs2017从而下载vs015

VS2015 专业版下载链接
http://download.microsoft.com/download/B/8/9/B898E46E-CBAE-4045-A8E2-2D33DD36F3C4/vs2015.pro_chs.iso

VS2015 企业版下载链
http://download.microsoft.com/download/B/8/F/B8F1470D-2396-4E7A-83F5-AC09154EB925/vs2015.ent_chs.iso

VS2015 社区版下载链接
http://download.microsoft.com/download/B/4/8/B4870509-05CB-447C-878F-2F80E4CB464C/vs2015.com_chs.iso

在opencv中sift、surf等一些算法被去除,使用modules不再是默认安装的,它们均被集中在opencv_contrib中,在配置OpenCV时需要同OpenCV源码一块编译,需要重新下载并进行编译,下载contrib链接  https://github.com/opencv/opencv_contrib

因为要使用opencv中的GPU对程序进行加速  所以需要下载cuda,可以cuda官网查看与自己,这里我下载的是cuda8.0

此外还需要下载CMake编译工具对opecv库重新进行编译 加入GPU支持和一些额外的模块库

下载好CMake、OpenCV库、cuda和opecv_contrib后打开CMake

在Where is the source code里面选择opencv文件目录下的sources文件夹

在opencv文件目录下创建build-vs2017(文件名可以自己命名)

在Where to build the binaries里面选择该文件夹用于存放编译后的二进制文件

 点击Configure出现下面信息证明配置完成(如果报错:No CMAKE_CXX_COMPILER could be found一类的错误信息证明vs2015模块不全 可查看这篇文章https://blog.csdn.net/u013832707/article/details/53127710)

查看WITH_CUDA是否被选中(默认被选中)

在如下选择opecv额外模块库的文件夹位置D:/opencv3.4.1/opencv_contrib-3.4.1/modules,最好通过后面的...进行添加,如果直接复制路径的话子文件夹用\分割 这里的是/分割(这里遇到了一个坑)

 然后再次选择Configure

 

Configure Done后选择Generate

点击OpenProject或者build-vs2017下的OpenCV.sln

 点击重新生成解决方案

 

opencv_aruco341d.lib
opencv_bgsegm341d.lib
opencv_bioinspired341d.lib
opencv_calib3d341d.lib
opencv_ccalib341d.lib
opencv_core341d.lib
opencv_cudaarithm341d.lib
opencv_cudacodec341d.lib
opencv_cudafeatures2d341d.lib
opencv_cudafilters341d.lib
opencv_cudaimgproc341d.lib
opencv_cudalegacy341d.lib
opencv_cudaobjdetect341d.lib
opencv_cudaoptflow341d.lib
opencv_cudastereo341d.lib
opencv_cudawarping341d.lib
opencv_cudev341d.lib
opencv_datasets341d.lib
opencv_dnn_objdetect341d.lib
opencv_dnn341d.lib
opencv_dpm341d.lib
opencv_face341d.lib
opencv_features2d341d.lib
opencv_flann341d.lib
opencv_fuzzy341d.lib
opencv_highgui341d.lib
opencv_img_hash341d.lib
opencv_imgcodecs341d.lib
opencv_imgproc341d.lib
opencv_line_descriptor341d.lib
opencv_ml341d.lib
opencv_objdetect341d.lib
opencv_optflow341d.lib
opencv_phase_unwrapping341d.lib
opencv_photo341d.lib
opencv_plot341d.lib
opencv_reg341d.lib
opencv_rgbd341d.lib
opencv_saliency341d.lib
opencv_shape341d.lib
opencv_stereo341d.lib
opencv_stitching341d.lib
opencv_structured_light341d.lib
opencv_superres341d.lib
opencv_surface_matching341d.lib
opencv_text341d.lib
opencv_tracking341d.lib
opencv_video341d.lib
opencv_videoio341d.lib
opencv_videostab341d.lib
opencv_xfeatures2d341d.lib
opencv_ximgproc341d.lib
opencv_xobjdetect341d.lib
opencv_xphoto341d.lib

这个编译是完全编译,其实已经包括了开头所说xfeature2d等模块,使用时只需改变一下依赖的lib就可以了。还有如果觉得自己完成太花时间的话,这里附上编译好的成品——include和install文件夹,可以直接用 

https://download.csdn.net/download/goerge_l/10320907

 

 

如果还是失败 就使用opencv2.4+CUDA+vs2015重新编译(不需要加入额外的opecv_contrib模块 因为opencv2中还存在SURF等算法  只不过在opencv3中移除了需要自己重新进行编译)

 

转载于:https://www.cnblogs.com/henuLiGang/p/10448757.html