在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)問題 –