使用NUGET PAckage Manager安装的OpenCvSharp未检测到CUDA设备 [英] OpenCvSharp installed using NUGET PAckage Manager not detecting a CUDA Device

查看:450
本文介绍了使用NUGET PAckage Manager安装的OpenCvSharp未检测到CUDA设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用OpenCvSharp包括GPU.我在Microsoft Visual Studio 2013中使用Nuget软件包管理器安装了OpenCvSharp.

I am trying to include GPU using OpenCvSharp. I installed the OpenCvSharp by using Nuget Package Manager in Microsoft Visual Studio 2013.

我已经包含了这些行

                 using OpenCvSharp;
                 using OpenCvSharp.CPlusPlus;
                 using OpenCvSharp.CPlusPlus.Gpu;

但是当我检查设备数量

  //GPU
                int count = Cv2Gpu.GetCudaEnabledDeviceCount();
                //int count = Cv2Gpu.ge
                Console.WriteLine("The GPU Device count is " +  count.ToString());

它总是返回0.

现在它还说如果OpenCv没有用CUDA编译,那么它总是返回0. 它甚至没有得到DeviceDetails.

Now it also says if OpenCv is not compiled with CUDA then it always returns 0. it does not even get DeviceDetails.

推荐答案

我已经通过构建opencv_core.dll和opencv_gpu.dll解决了此问题.

I have resolved this problem by building the opencv_core.dll and opencv_gpu.dll.

用Cmake制作opencv的源代码,并且不要忘记先配置源代码就选择"withcuda"选项.

Make the source code of opencv with Cmake and dont forget to select "withcuda" option while configuring the source code first.

生成后,然后在构建文件夹中打开OpenCv解决方案,并首先构建opencv_core,然后构建opencv_gpu.

after generation then open OpenCv solution in build folder and first build opencv_core and then opencv_gpu.

一旦您将bin文件夹中的dll替换为opencvsharp软件包文件夹中的dll.现在再次构建项目.现在,该项目会将新的dll复制到所需的文件夹中.

once you got the dll in the bin folder replace them in the opencvsharp package folder. Now build the project again. Now the project will copy the new dll's to the required folder.

这篇关于使用NUGET PAckage Manager安装的OpenCvSharp未检测到CUDA设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆