Started initial support for OpenCL. OpenCV doesn't yet officially support OpenCL LBP GPU acceleration -- but it should be coming soon

This commit is contained in:
Matt Hill
2014-01-19 13:22:41 -06:00
parent e1af64fcb1
commit 4004330987
7 changed files with 68 additions and 13 deletions

View File

@@ -31,6 +31,34 @@ AlprImpl::AlprImpl(const std::string country, const std::string runtimeDir)
this->topN = DEFAULT_TOPN;
this->defaultRegion = "";
if (config->opencl_enabled)
{
cv::ocl::PlatformsInfo platinfo;
cv::ocl::getOpenCLPlatforms(platinfo);
for (int i = 0; i < platinfo.size(); i++)
{
std::cout << platinfo[i]->platformName << std::endl;
}
cv::ocl::DevicesInfo devices;
cv::ocl::getOpenCLDevices(devices, cv::ocl::CVCL_DEVICE_TYPE_CPU);
for (int i = 0; i < devices.size(); i++)
std:: cout << devices[i]->deviceName << std::endl;
if (devices.size() > 0)
{
cv::ocl::setDevice(devices[0]);
cout << "Using OpenCL Device: " << devices[0]->deviceName << endl;
}
else
{
cout << "OpenCL initialization failed. Runtime drivers may not be installed." << endl;
}
}
}
AlprImpl::~AlprImpl()
{