OpenCV 3.2 CUDA python support

I just installed OpenCV 3.2 compilation with CUDA support by following the instructions at http://www.pyimagesearch.com/2016/07/11/compiling-opencv-with-cuda-support/ I'm just wondering how to check if my OpenCV using CUDA and GPU support at startup (I am using python2.7)

+6


source to share


1 answer


As you can see from the link you provided , you can always check if you installed correctly by CUDA

typing this in the console python

.

print(cv2.getBuildInformation())

      

If you have CUDA support, you will see that Use CUDA: YES (version)

in the printed text.

Then you can use opencv cuda commands in the module cv2.cuda

.

But as said in this tutorial, CUDA

there is currently no support in python. (Since these tutorials OpenCV python

on OpenCV python

you do not understand whether it will add support CUDA

for python

. But it is not so .. )

In addition, in a GPU-enabled CUDA environment, there are a number of compile-time optimizations we can make for OpenCV, which allows us to take advantage of the GPU for faster computation (but mostly for C ++ applications, not Python). at least for the time being).



But as described in this answer , you can get support OpenCL

in python. As in this document,

The Open Computing Language (OpenCL) is an open standard for writing code that runs on heterogeneous platforms including CPUs, GPUs, DSPs, and more.

Edit 1:

Another thing you can do is you can write wrappers python

for each method GPU

in OpenCV C++

and call those methods through python

. I will not recommend this because it will always copy images and other data between memory GPU

and RAM

will result in poor performance. Sometimes it will take longer than one CPU

.

Another thing you can do is write the entire function you need to do using GPU

in C++

and write a wrapper around python

that function. This is much better than the previous method, but you need to know C++

.

There may be even better ways to do this ..

+14


source







All Articles