I am using the TI's AM5718 Soc for developing the cv project, while i am using the opencv3.1.0,the opencl support for opencv is not completely. I could find out the opencl's device by opencv-ocl code, while i use the device to processing the image,it tell me the device isn't setting up!Here the opencv-ocl code and the result of it! I want to know, how can i eable the DSP accelerate to be my opencl deivice and use it.
#include <iostream> #include "opencv2/opencv.hpp" #include "opencv2/core/ocl.hpp" #include "opencv2/imgcodecs.hpp" #include "opencv2/videoio/videoio.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" using namespace std; using namespace cv; using namespace cv::ocl; #define DSP 1 int main() { double t = 0.0; std::vector<cv::ocl::PlatformInfo> plats; cv::ocl::getPlatfomsInfo(plats); const cv::ocl::PlatformInfo *platform = &plats[0]; cout << "Platform Name:" << platform->name().c_str() << endl; cv::ocl::Device c_dev; platform->getDevice(c_dev,0); cout << "Device name:" << c_dev.name().c_str() << endl; c_dev.set(0); cv::ocl::setUseOpenCL(true); #if DSP cv::UMat Ori = cv::imread("/home/root/test.jpg").getUMat(cv::ACCESS_RW),Res; cout << "Use the OpenCL Deivice?" << cv::ocl::useOpenCL() << endl; t = (double)cv::getTickCount(); cv::cvtColor(Ori,Res,cv::COLOR_RGB2GRAY); t = ((double)cv::getTickCount() - t) / cv::getTickFrequency(); std::cout << "TI AM57x Accelerate Time Cost:" << t << "s" << std::endl; cv::imshow("Test",Ori); cv::imshow("Gray",Res); #else Mat I = imread("/home/root/test.jpg"),gray; t = (double)cv::getTickCount(); cv::cvtColor(I,gray,cv::COLOR_RGB2GRAY); t = ((double)cv::getTickCount() - t) / cv::getTickFrequency(); std::cout << "CPU Time Cost:" << t << "s" << std::endl; cv::imshow("Ori",I); cv::imshow("Res",gray); #endif for (;;) { int key = waitKey(); if (key == 27/*ESC*/ || key == 'q' || key == 'Q') break; } return 0; }
The result:
The Use the OpenCL Device?Show that the DSP Accelerate is not being using as a opencl device.
I want to know whether the opencv-ocl library can support the dsp to be a opencl-device?
Look forward to your reply,thanks!