Ask Your Question

Anirudh GP's profile - activity

2016-12-09 04:47:46 -0500 answered a question OCL error - assertion failed

The problem is that it is trying to use the Intel GPU instead of the Nvidia GPU. I solved this by choosing the Nvidia GPU as the OpenCL Device.

You can use this code to see what devices are present and then choose the right one :

cv::ocl::DevicesInfo devInfo;
int res = cv::ocl::getOpenCLDevices(devInfo);
if (res == 0)
{
    std::cerr << "There is no OPENCL Here !" << std::endl;
}
else
{
    for (unsigned int i = 0; i < devInfo.size(); ++i)
    {
        std::cout << "Device : " << devInfo[i]->deviceName << " is present" << std::endl;
    }
}
cv::ocl::setDevice(devInfo[1]);

Use the setDevice() function to set it to the Nvidia GPU

2016-12-09 01:44:58 -0500 commented question OCL error - assertion failed

Any fix to this? I have the same problem

2016-12-09 01:44:58 -0500 asked a question OpenCV gives Assertion failed error when running on GPU using OpenCL

I have an "Nvidia GTX 970M" GPU & I am trying to run a face detection algorithm in c++ that runs on the GPU using OpenCL.

The function where this error occurs is :

ocl::OclCascadeClassifier::detectMultiScale()

The error I get is :

OpenCV Error: Assertion failed (localThreads[0] * localThreads[1] * localThreads[2] <= kernelWorkGroupSize) in cv::ocl::openCLVerifyKernel

I know that this problem is related to the GPU of the device but I do not know how to fix this. I have tried using OpenCV versions 2 and 3 but both give the same problem.