Ale*_*lex 1 opencv x86-64 image-processing opencl opencv3.0
众所周知,OpenCV 3.0支持新类cv::Umat,它提供透明API(TAPI)以自动使用OpenCL,如果它可以:http://code.opencv.org/projects/opencv/wiki/Opencv3#tapi
cv::UmatTAPI 有两个简介:
但如果我有:
如果我在OpenCV中打开OpenCL,那么如何在OpenCL代码执行时更改设备:在8核CPU,集成高清显卡上,在第一个nVidia GPU或第二个nVidia GPU上?
如何选择这4个设备中的每个设备使用OpenCL进行并行执行算法cv::Umat?
例如,如何在4xCore的CPU Core-i5上使用OpenCL加速cv::Umat?
我使用这样的东西来检查用于OpenCL支持的版本和硬件.
ocl::setUseOpenCL(true);
if (!ocl::haveOpenCL())
{
cout << "OpenCL is not available..." << endl;
//return;
}
cv::ocl::Context context;
if (!context.create(cv::ocl::Device::TYPE_GPU))
{
cout << "Failed creating the context..." << endl;
//return;
}
cout << context.ndevices() << " GPU devices are detected." << endl; //This bit provides an overview of the OpenCL devices you have in your computer
for (int i = 0; i < context.ndevices(); i++)
{
cv::ocl::Device device = context.device(i);
cout << "name: " << device.name() << endl;
cout << "available: " << device.available() << endl;
cout << "imageSupport: " << device.imageSupport() << endl;
cout << "OpenCL_C_Version: " << device.OpenCL_C_Version() << endl;
cout << endl;
}
Run Code Online (Sandbox Code Playgroud)
然后,您可以使用此设置要使用的首选硬件
cv::ocl::Device(context.device(1));
Run Code Online (Sandbox Code Playgroud)
希望这对你有所帮助.
| 归档时间: |
|
| 查看次数: |
3980 次 |
| 最近记录: |