OpenCvSharp installed using NUGET PAckage Manager

2019-08-31 23:32发布

问题:

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

I have included these lines already

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

but when i check the device count

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

it always returns 0.

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

回答1:

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

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

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

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.