python opencv调用cuda_OpenCV 3.2 CUDA支持python

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 wonder how to check whether my OpenCV is using CUDA and GPU support when running (I use python2.7)

解决方案

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..

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值