使用OpenCv 2.4.10 + Cuda 7.5 + W10

时间:2015-09-25 04:10:18

标签: c++ opencv visual-studio-2013 windows-10

我尝试使用以下方式启动并运行:

  • OpenCv 2.4.10
  • Visual Studio 2013
  • Cuda toolkit 7.5(测试和运行的cuda样本)
  • Windows 10 x64
  • 联想Y50与NVIDIA GEFORCE GTX 860M

我使用CMake和WITH_CUDA = ON编译了OpenCv,然后通过打开OpenCv.sln并构建了ALLBUILD和INSTALL项目来安装库。

将我的项目配置设置为:

  • VC ++目录

    • 包括目录:
      • C:\ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v7.5 \ include
      • C:\ OpenCv \ opencv \ build \ install \ include(包含已编译的库)
      • C:\的OpenCV \的OpenCV \建立\包括
  • Linker-general-Additional libraries

    • C:\的OpenCV \的OpenCV \建立\ 64 \ VC12 \ lib中
    • C:\的OpenCV \的OpenCV \建立\安装\ 64 \ VC12 \ lib中
  • 链接器输入 - 附加依赖

    • opencv_calib3d2410d.lib
    • opencv_contrib2410d.lib
    • opencv_core2410d.lib
    • opencv_features2d2410d.lib
    • opencv_flann2410d.lib
    • opencv_gpu2410d.lib
    • opencv_highgui2410d.lib
    • opencv_imgproc2410d.lib
    • opencv_legacy2410d.lib
    • opencv_ml2410d.lib
    • opencv_nonfree2410d.lib
    • opencv_objdetect2410d.lib
    • opencv_ocl2410d.lib
    • opencv_photo2410d.lib
    • opencv_stitching2410d.lib
    • opencv_superres2410d.lib
    • opencv_ts2410d.lib
    • opencv_video2410d.lib
    • opencv_videostab2410d.lib

我的环境变量: Path = C:\ Program Files \ NVIDIA GPU Computing; Toolkit \ CUDA \ v7.5; C:\ OpenCv \ opencv \ build \ install \ x64 \ vc12 \ bin; C:\ OpenCv \ opencv \ build \ x64 \ vc12 \仓

测试代码:

   #include "opencv2\opencv.hpp"
   #include "opencv2\gpu\gpu.hpp"

    using namespace cv::gpu;
    using namespace std;

    int main() {
        {
        setDevice(0); 
        int gpu = getCudaEnabledDeviceCount();
        cout << gpu ;
        system("pause");
        return 0;
        }

}in

但是setDevice抛出

  

没有GPU支持(在没有CUDA支持的情况下编译库)   EmptyDeviceInfoFuncTable :: setDevice,file   C:\建立\ 2_4_PackSlave-Win64的-VC12共享\的OpenCV \ dynamicuda \包括\ opencv2 / dynamiccuda / dynamicuda.hpp。   第84行

如果我评论setDevice(0)仍未检测到gpu,则getCudaEnabledDeviceCount返回0.

1 个答案:

答案 0 :(得分:1)

问题是Opencv 2.4.10支持CUDA 4.2,我的视频卡只与CUDA 6.5和7.5兼容,我通过安装OpenCV 3.0.0解决了