Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the macro CV_OCL_RUN used for in OpenCV?

Tags:

c++

opencv

I was learning hog.cpp implemented in OpenCV, when encountered the macro CV_OCL_RUN and confused with it.

In hog.cpp where detectMultiScale() locates, you can find CV_OCL_RUN and a method called ocl_detectMultiScale() in it. Compared between detectMultiScale() and ocl_detectMultiScale(), not only their names but their implement are quite similar.

Here are my questions:

  1. What is the macro CV_OCL_RUN used for? Does it for test or other purpose?
  2. Since detectMultiScale() and ocl_detectMultiScale() are so similar in functionality, why the later is embedded in the former ? What ways are they called in?

Thanks in advance!

like image 633
foo Avatar asked Feb 23 '17 09:02

foo


1 Answers

  1. CV_OCL_RUN is for OpenCL code.
  2. If your computer is not able to use OpenCL capabilities (no GPU or no OpenCL driver), regular code (CPU) is run. You can also switch between regular code or use OpenCL version in the code. If setUseOptimized() or setUseOpenCL() is set to false, regular code will be used.

You can find in the opencl directory the kernel code which will be run on the GPU device.

PS: OpenCL is not only for GPU.

like image 123
Catree Avatar answered Nov 02 '22 00:11

Catree