c++ - 使用 NuGet 包将带有 Cuda 的 OpenCV 添加到 Visual Studio 程序中?

标签 c++ opencv visual-studio-2013 visual-studio-2015 cuda

问题:如何使用 Cuda 将 NuGet 包添加到 Visual Studio 2013 程序以用于 OpenCV?

Windows 10 x64 位系统

Visual Studio 2015 从这里使用 Nuget 包安装命令:Opencv CUDA Contrib vc12 Debug Build 3.1.0以及 VS 2015 中的 VS 2013 平台工具集。

程序编译没有任何错误,但是当我去运行它时,我得到以下命令行提示错误:

OpenCV Error: No CUDA support (The library is compiled without CUDA support) in throw_no_cuda, file C:\builds\master_PackSlave-win64-vc12-shared\opencv\modules\core\include\opencv2/core/private.cuda.hpp, line 97

Visual Studio 2013 NuGet 包安装失败并返回以下错误:

    PM> Install-Package opencvcuda-debug
The source at All [(Aggregate source)] is unreachable. Falling back to NuGet Local Cache at C:\Users\ruffolo\AppData\Local\NuGet\Cache
Install-Package : Unable to find package 'opencvcuda-debug'.
At line:1 char:1
+ Install-Package opencvcuda-debug
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

最佳答案

Visual Studio 2013 解决方案

首先
转到工具-> NuGet 包管理器-> 包管理器设置
从左侧的选项列表中选择'Package Sources',并确保在 Available package sources 下有一个条目,其中为 nuget.org 选中了复选框,网址为 https://www.nuget.org/api/v2/

我还选中了 Machine-wide package sources: Microsoft and .NET 的复选框,网址为 https://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/

下一步
工具 -> NuGet 包管理器 -> 管理解决方案的 NuGet 包

search for: Opencv CUDA Contrib vc12 Debug Build 3.1.0

选择合适的包并安装。

终于
将 include 和 lib 文件的适当文件路径添加到 VS 2013 项目。这些文件将位于.../project name/Packages/Package Name/...中的某处

此时程序应该编译并运行。

我还没有找到让它在 VS 2015 中工作的解决方法。

关于c++ - 使用 NuGet 包将带有 Cuda 的 OpenCV 添加到 Visual Studio 程序中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38018425/

相关文章:

c++ - 指向多态类层次结构中派生类型的智能指针,编译错误

c++ - 多次使用时,将 vector 大小存储到 int 变量中是否更有效?

python - Python OpenCV TypeError:找不到必需的参数 'layout'(pos 2)

c++ - 计算正方形的方向并显示具有相同方向的对象

c# - 如何将预处理器符号与自定义构建配置一起使用?

c++ - 为什么在使用 Unix 和 Windows 系统的 C++ 中声明指针时会出现这种行为?

opencv - BackgroundSubtractorMOG2 的掩码

OpenCV 尝试加载未安装的 Cuda dll

visual-studio-2013 - Visual Studio 2013 - 不再能够与 MSTest 并行运行 xunit 测试

c++ - 矩阵对角零点