Ask Your Question

Revision history [back]

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