OpenCV 3.2 CUDA support python

前端 未结 1 2026
迷失自我
迷失自我 2021-01-12 08:41

I\'ve just installed OpenCV 3.2 compiling with CUDA support following instruction in http://www.pyimagesearch.com/2016/07/11/compiling-opencv-with-cuda-support/ I just wond

相关标签:
1条回答
  • 2021-01-12 09:02

    As you can see in the link you gave, you can always check whether you have installed CUDA correctly by typing this on python console.

    print(cv2.getBuildInformation())
    

    If you have CUDA support, you will be seen that Use CUDA: YES (version) in the printed text.

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

    But as said in that tutorial CUDA support is not there at present in python. (As these tutorials are on OpenCV python you will get confused whether this will add CUDA support for python. But it will not..)

    Furthermore, in a GPU-enabled CUDA environment, there are a number of compile-time optimizations we can make to OpenCV, allowing it to take advantage of the GPU for faster computation (but mainly for C++ applications, not so much for Python, at least at the present time).

    But as described in this answer, you can get OpenCL support on python. As in this document,

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

    Edit 1:

    Another thing that you can do is, you can write python wrappers for each GPU methods in OpenCV C++ and call those methods via python. I will not recommend that because this will always copy images and other data between GPU memory and RAM resulting bad performance. Sometimes this will take more time than CPU alone.

    Another thing that you can do is writing the whole function you need to do using GPU in C++ and write a python wrapper for that function. This is much more better than the previous method but you will need to know C++.

    There can be even better ways of doing this..

    0 讨论(0)
提交回复
热议问题