问题:如何使用 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/