mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 09:36:51 +08:00
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:
@@ -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()
|
||||
{
|
||||
|
Reference in New Issue
Block a user