Finally I was able to compile the Code in the Tutorial 4 of Android OpenCV [here](https://github.com/Itseez/opencv/blob/master/samples/android/tutorial-4-opencl/jni/CLprocessor.cpp) .
It works flawelessly on my Xperia Z1. It speeds up processing time about 4-5 times. The step to convert GL-Image to UMat is here:
cv::UMat uIn, uOut, uTmp;
cv::ocl::convertFromImage(imgIn(), uIn);
LOGD("loading texture data to OpenCV UMat costs %d ms", getTimeInterval(t));
theQueue.enqueueReleaseGLObjects(&images);
t = getTimeMs();
//cv::blur(uIn, uOut, cv::Size(5, 5));
cv::Laplacian(uIn, uTmp, CV_8U);
cv:multiply(uTmp, 10, uOut);
cv::ocl::finish();
LOGD("OpenCV processing costs %d ms", getTimeInterval(t));
t = getTimeMs();
cl::ImageGL imgOut(theContext, CL_MEM_WRITE_ONLY, GL_TEXTURE_2D, 0, texOut);
images.clear();
How could I use the code above with an image from the file-system using `imread` ?
I've tried the Tags like ACCESS_READ, ACCESS_RW, etc. but the code slows down - I think because it's due to CPU-processing. Any Ideas?
↧