M. Ruffolo
M. Ruffolo

Reputation: 101

Adding OpenCV with Cuda to Visual Studio program with NuGet package?

Question: How do I add a NuGet package to a Visual Studio 2013 program for OpenCV with Cuda?

Windows 10 x64 bit system

Visual Studio 2015 Using Nuget package install command from here: Opencv CUDA Contrib vc12 Debug Build 3.1.0 and the VS 2013 Platform Toolset in VS 2015.

Program compiles without any errors but when I go to run it I get the following command line prompt error:

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 package fails to install with the following error return:

    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

Upvotes: 0

Views: 1937

Answers (1)

M. Ruffolo
M. Ruffolo

Reputation: 101

Visual Studio 2013 Solution

First
go to tools-> NuGet Package Manager -> Package Manager Settings
select 'Package Sources' from the list of options on the left and make sure that under Available package sources there is an entry with the check box selected for nuget.org with the web address https://www.nuget.org/api/v2/

I also selected the checkbox for Machine-wide package sources: Microsoft and .NET with the web address https://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/

Next
tools-> NuGet Package Manager -> Manage NuGet Packages for Solution

search for: Opencv CUDA Contrib vc12 Debug Build 3.1.0

select the appropriate package and install.

Finally
Add the appropriate file paths for the include and lib files to your VS 2013 project. These files will be located somewhere in .../project name/Packages/Package Name/...

Program should compile and run at this point.

I've not found a workaround for getting this to work in VS 2015 yet.

Upvotes: 2

Related Questions