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.
asked Aug 31, 2013 at 20:32
Katsu
1,9584 gold badges20 silver badges29 bronze badges
-
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
2 Answers 2
Right now OpenCV 2.4.7 doesn't support the GPU module on OpenCV-Python.
That means that you must write wrappers yourself.
answered Nov 25, 2013 at 3:12
karlphillip
93.7k38 gold badges254 silver badges449 bronze badges
Sign up to request clarification or add additional context in comments.
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.
answered Jan 12, 2018 at 13:48
sparkitny
1,5434 gold badges19 silver badges23 bronze badges
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/…
lang-py