Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Imread() Umat for OpenCL in Android doesn't work!?

Finally I was able to compile the Code in the Tutorial 4 of Android OpenCV here .

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));

    t = getTimeMs();
    //cv::blur(uIn, uOut, cv::Size(5, 5));
    cv::Laplacian(uIn, uTmp, CV_8U);
    cv:multiply(uTmp, 10, uOut);
    LOGD("OpenCV processing costs %d ms", getTimeInterval(t));

    t = getTimeMs();
    cl::ImageGL imgOut(theContext, CL_MEM_WRITE_ONLY, GL_TEXTURE_2D, 0, texOut);

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?