Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Build OpenCV with OpenCL support

in CMake, I built OpenCV with OpenCL Enable ON(It automatically detected the OPENCL_INCLUDE_DIR path but the OPENCL_LIBRARY was empty, even after clicking config. for OPENCL_LIBRARY i don't see browse button either .. after generating opencv binaries then i run the below code

#include <iostream>
#include <fstream>
#include <string>
#include <iterator>
#include <opencv2/opencv.hpp>
#include <opencv2/core/ocl.hpp>

int main()
{
  if (!cv::ocl::haveOpenCL())       
      cout << "OpenCL is not avaiable..." << endl;          
   else cout << "OpenCL is AVAILABLE! :) " << endl; //this is the output

   cv::ocl::setUseOpenCL(true);

   cout << context.ndevices() << " GPU devices are detected." << endl; 
   for (int i = 0; i < context.ndevices(); i++)
   {
     cv::ocl::Device device = context.device(i);
     cout << "name:              " << device.name() << endl;
     cout << "available:         " << device.available() << endl;
     cout << "imageSupport:      " << device.imageSupport() << endl;
     cout << "OpenCL_C_Version:  " << device.OpenCL_C_Version() << endl;
     cout << endl;
    } //this works & i can see my video card name & opencl version
    cv::ocl::Device(context.device(0));
}

When i make use of UMat to measure the performance, the performance with(UMat) or without(Mat) OpenCL did not make any difference.

I downloaded AMD-APP-SDK from this link and tried to build but there was no OpenCL binaries (instead i saw opengl dll files[glew32.dll & glut32.dll]. How do i build OpenCV with OpenCL by linking the OPENCL_LIBRARY?