AnsweredAssumed Answered

run opencl app on iMX6Q: openCV error

Question asked by Gavin Guo on Nov 2, 2018
Latest reply on Nov 6, 2018 by Victor Linnik

we run the opencl test program(we want use GPU to accelate image processing speed) on the imx6q platform BSP Linux 3.14.52, and get the error infomation below(the same error happened in BSP Linux 4.1.15):
In image read [1520 x 932]
loops: 0, detect face using gpu...

OpenCV Error: Assertion failed (localThreads[0] * localThreads[1] * localThreads[2] <= kernelWorkGroupSize) in openCLVerifyKernel, file /home/tangb/yocto/imx-3.14.52-1.1.0_ga/build-fb/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/opencv/2.4.11+gitAUTOINC+2c9547e314-r0/git/modules/ocl/src/cl_operations.cpp, line 349
terminate called after throwing an instance of 'cv::Exception'
what(): /home/tangb/yocto/imx-3.14.52-1.1.0_ga/build-fb/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/opencv/2.4.11+gitAUTOINC+2c9547e314-r0/git/modules/ocl/src/cl_operations.cpp:349: error: (-215) localThreads[0] * localThreads[1] * localThreads[2] <= kernelWorkGroupSize in function openCLVerifyKernel



And we test function is:

void detect( Mat& img, vector<Rect>& faces,
ocl::OclCascadeClassifier& cascade,
double scale, bool calTime)
printf("detect face using gpu...\n\n");
ocl::oclMat image(img);
ocl::oclMat gray, smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 );
if(calTime) workBegin();
ocl::cvtColor( image, gray, CV_BGR2GRAY );
ocl::resize( gray, smallImg, smallImg.size(), 0, 0, INTER_LINEAR );
ocl::equalizeHist( smallImg, smallImg );

cascade.detectMultiScale( smallImg, faces, 1.1,
3, 0
, Size(30,30), Size(0, 0) );
printf("#### 6\n");
printf("detect %d faces:\n",faces.size());
for(int i = 0;i < faces.size();i++){
printf("face %d : (%d,%d,%d,%d)\n",i,faces[i].x,faces[i].y,faces[i].width,faces[i].height);
if(calTime) workEnd();


someone can tell us how to do?