0

I have a program that processes videos using foreground detection in OpenCV 2.4.9/python/on windows and packaged for a windows executable using py2exe. I recently updated opencv to opencv3 and repackaged my program. When i run on my computer (with opencv3 installed locally) everything goes fine.

However, when a user goes and downloads the program and runs it on another computer, they get the warning

Failed to load OpenCL runtime

This just seems to be just a warning, and i can detect no performance issues.

I have a couple options. I can just suppress this specific warning in a try statement, or i can somehow turn off the OpenCL on my computer for packaging the program. Suggestions on either strategy would be appreciated. Anything i am overlooking? To my understanding the OpenCL library is for acceleration using GPU.

Thanks,

bw4sz
  • 2,237
  • 2
  • 29
  • 53

3 Answers3

2

the solution will be compiling the OpenCV libs without OpenCL and then link them to your application

madduci
  • 2,635
  • 1
  • 32
  • 51
  • Would i have to compile from source, edited to mention this is on Windows. I've gone back and there isn't anything in the windows binary giving this option. Thanks. – bw4sz Sep 08 '14 at 11:22
  • 1
    you have to download OpenCV from github, then compile with ENABLE_OPENCL=OFF (using CMake) and use the built libs against your application – madduci Sep 08 '14 at 11:26
  • WITH_OPENCL=OFF (not enable_opencl) – berak Sep 08 '14 at 11:43
  • I've tried the flag, and building with the new library generated from cmake. Still getting the error. On some computers it just gives the warning flag and no consequences and on computers it gives a fatal error: opencl device not found check configuration. – bw4sz Sep 12 '14 at 21:40
  • Is the foreground extraction algorithm using any on GPU/OpenCL approach? If so, it won't work. On other side, if the libraries are compiled with WITH_OPENCL=OFF, then you should not get this error. Try to do a clean build and be sure you are linking the right libraries with your project. – madduci Sep 13 '14 at 16:05
  • Hello, my question is similar to this, but my need is a little bit different. May be you know the answer to my [question](http://stackoverflow.com/questions/29342179/opencv-failed-to-load-opencl-runtime) ? Thank you. –  Mar 30 '15 at 09:14
0

I had encounter the same problem, here's my solution:

  1. go to the Intel website and download the OpenCL library, then unzip it

  2. run the install.sh file

If your install fails because of update-alternatives errors, maybe it's because you are using Ubuntu/Debian distro and the Intel install package has a wrong setting with it.

To solve this, xfanzone did a very good job on this. Take a look here.

  1. download the patch zip file and patch your OpenCL package

  2. install it again, now it should work fine

fduff
  • 3,671
  • 2
  • 30
  • 39
0

If you just don't need to use OpenCL, you can set the environment var as below:

export OPENCV_OPENCL_RUNTIME=999

Sometimes, if you want to turn on the opencl:

export OPENCV_OPENCL_RUNTIME=
Karl Gjertsen
  • 4,690
  • 8
  • 41
  • 64
Eric Lew
  • 1
  • 1