Working on GPU in a generic way
Are there any tools or libraries that belong to opencv that enable GPU work in a generic way?
Are there any tools or libraries that belong to opencv that enable GPU work in a generic way?
There's a way to execute custom OpenCL code on the GPU from OpenCV using the cv::ocl classes and UMat type images.
Here you can find an example for doing this.
A word of warning: OpenCL code can be difficult to develop. It's massively parallel, has no concurrency checks (so it will crash for any bugs) and it's difficult to debug. OTOH OpenCL is very portable, it runs on most GPUs and on CPUs too (CUDA runs only on nVidia hardware).
I personally prefer using CPU parallelisation using TBB, it's much easier to implement.
Concerning CUDA, there is a cv::cuda namespace for CUDA-based operations. It has several image processing algorithms implemented, but I don't know if it's possible to run generic CUDA code.
Asked: 2019-09-12 07:39:17 -0600
Seen: 601 times
Last updated: Sep 13 '19
OpenCV 2.4.2 and trunk: cmake doesn't show CUDA options
Bilinear sampling from a GpuMat
Problem with FarnebackOpticalFlow / DeviceInfo
Difference between cpu and gpu detectMultiScale
Huge time to upload data to GPU
Pseudocode for custom GPU computation
calcHist with GpuMat submatrix
No. For that you'd need something like OpenGL 4.3, which has compute shaders. Here is a link to a sample compute shader app:
https://github.com/sjhalayka/qjs_comp...
Note that the code requires the GLUT and GLEW libraries.
Compute shaders were made official in 2012, with OpenGL 4.3. They're not new, and they are widely used.