I want to know if it is possible to use opencv gpu functions like those from here? Or I have to wrap it into python class.
-
There is an approach discussed: stackoverflow.com/questions/42125084/…Neeraj Gulia– Neeraj Gulia2019-01-31 05:54:39 +00:00Commented Jan 31, 2019 at 5:54
-
Possible duplicate of Accessing OpenCV CUDA Functions from Python (No PyCUDA)c-x-berger– c-x-berger2019-06-19 16:56:22 +00:00Commented Jun 19, 2019 at 16:56
Add a comment
|
2 Answers
Right now OpenCV 2.4.7 doesn't support the GPU module on OpenCV-Python.
That means that you must write wrappers yourself.
6 Comments
Katsu
Ok thank's, I did it, but in fact it's useless to wrap it because it's faster on CPU (allocation on GPU take more time)
karlphillip
The performance of GPU processing depends on a few factors: how fast the GPU is, how big the dimensions of the image are, and finally, the arithmetic intensity of the algorithm. In some cases the CPU will really be faster! But that usually happens with small images or with algorithms with low arithmetic intensity.
fbence
Since it's been 3 years since the answer and OpenCV 3 is out, is this still the case?
Farhan
@fbence Yes, unfortunately this is still the case.
fbence
@Farhan there seems to be a contradictory answer alreasy
|
To answer the question in the comment made by fbence in the accepted answer, this is now possible with OpenCV 3 and Python 2.7+ or Python 3+. However, the OpenCV 3 GPU module must be compiled from source.
Assuming you are working on a Linux system you can follow these guides:
- For OpenCV 3 GPU and Python 2.7+ follow this guide.
- For OpenCV 3 GPU and Python 3, follow this guide from Step 0 to Step 5.
3 Comments
Farhan
This is incorrect! OpenCV does not have python bindings for CUDA enabled classes.
Farhan
In fact, you can see in the guide for Python 3 that the author compiles OpenCV with the flag "-D WITH_CUDA=OFF"! This means the author isn't even compiling OpenCV with CUDA support!
Neeraj Gulia
Follow this answer: stackoverflow.com/questions/42125084/…