在CMake中,我用OpenCL打开了OpenCV启用(它自动检测到OPENCL_INCLUDE_DIR
路径,但OPENCL_LIBRARY
是空的,即使在单击配置后,对于OPENCL_LIBRARY
我也没有看到浏览按钮。 OpenCV的二进制文件,然后我运行下面的代码用OpenCL支持构建OpenCV
#include <iostream>
#include <fstream>
#include <string>
#include <iterator>
#include <opencv2/opencv.hpp>
#include <opencv2/core/ocl.hpp>
int main()
{
if (!cv::ocl::haveOpenCL())
cout << "OpenCL is not avaiable..." << endl;
else cout << "OpenCL is AVAILABLE! :) " << endl; //this is the output
cv::ocl::setUseOpenCL(true);
cout << context.ndevices() << " GPU devices are detected." << endl;
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;
} //this works & i can see my video card name & opencl version
cv::ocl::Device(context.device(0));
}
当我利用UMat
来衡量性能,用(UMAT)或无业绩(MAT)的OpenCL没有任何区别。
我下载AMD-APP-SDK从这link并尝试建立但没有OpenCL二进制文件(而是我看到了opengl dll文件[glew32.dll & glut32.dll]。我如何通过链接OPENCL_LIBRARY与OpenCL构建OpenCV?
我在C:/ windows/System32中发现opencl.dll,删除它。但是使用了GPU。 也可以回答[this](http://stackoverflow.com/questions/41688751/understanding-the-usage-of-opencl-in-opencv-mat-umat-objects?noredirect=1#comment70603090_41688751)问题 –