Provide OpenCL information and instructions.

This commit is contained in:
Kees-V
2015-09-24 18:28:25 +02:00
parent 04b4153739
commit faa152eb1b

View File

@@ -38,6 +38,46 @@ namespace alpr
cv::ocl::setUseOpenCL(true);
if (config->debugDetector)
{
try{
cout << "\r\nUse of OpenCL LBP detector selected in config file." << endl;
cv::ocl::Device ocldevice;
std::vector<cv::ocl::PlatformInfo> platforms;
getPlatfomsInfo(platforms);
if (platforms.size()>0) cout << "OpenCL device(s) found:" << endl;
int n = 0;
for (size_t i = 0; i < platforms.size(); i++)
{
const cv::ocl::PlatformInfo* platform = &platforms[i];
for (int j = 0; j < platform->deviceNumber(); j++)
{
platform->getDevice(ocldevice, j);
cout << n << " " << ocldevice.name() << " (" << ocldevice.version() << ")" << endl;
n++;
}
}
if (n > 1)
{
ocldevice = cv::ocl::Device::getDefault();
if (ocldevice.available())
{
cout << "\r\nCurrent OpenCL device: \r\n " << ocldevice.name() << " (" << ocldevice.version() << ").\r\n" << endl;
}
else
{
cout << "\r\nOpenCL error: The selected device is not available.\r\n" << endl;
}
cout << "Select the OpenCL device by adjusting the environment variable OPENCV_OPENCL_DEVICE, e.g.\r\n-In Windows type at the command prompt:\r\n set OPENCV_OPENCL_DEVICE=::1\r\n" << endl;
}
}
catch (...)
{
cout << "OpenCL error: No OpenCL device found.\r\n" << endl;
}
}
if (!ocl::haveOpenCL())
{
this->loaded = false;
@@ -50,7 +90,7 @@ namespace alpr
else
{
this->loaded = false;
printf("--(!)Error loading CPU classifier\n");
cout << "--(!)Error loading cascade " << config->country << ".xml\n" << endl;
}
}