Ask Your Question

Revision history [back]

OpenCV Cuda (cuda:: VS gpu::)

hello folks, I hope you are doing good.

I need some help, would you mind helping the brother out? The thing is that I wrote a program using OpenCV C++ for a project that I am working on. Now I want the code to run on GPU, of course for faster results.

For converting the code to its GPU equivalent, here's the steps I followed:

  • Downloaded OpenCV 3.4.1 and activated GPU using cmake 3.12.0 rc3. (Using Cuda 9.0)
  • Added dependencies in Visual Studio 2015 Pro.

The GPU was activated, however for functions to run on GPU, I had to use cuda:: instead of gpu::. Why is that so? Also, there is no folder named as 'gpu' in the include folder where OpenCV is located. OpenCV website have examples that uses the gpu:: but it doesn't work on version 3. Additionally, the namespace cuda:: has its own functions that are limited and it doesn't support the functions I have used in my code, functions like; cvtColor, adaptiveThreshold, TemplateMatching, etc.

Succumbing to the problems mentioned above, I moved to OpenCV 2.4.13.6 because it had the "gpu" folder in it's include folder. But this version of OpenCV doesn't have imgcodecs.hpp that I am using in my project hence it doesn't support functions like distanceTransform. And also I was unable to GPU activate it using cmake, encountered some unusual errors. However one thing for sure that it does support gpu:: that I am seeking.

I apologize if this post seems like a rant post. I exhausted rite now.

Thanks in anticipation.