Validation error using TAPI (cv :: UMat) with large images - OpenCV

I get a rejection statement when using OpenCV TAPI ( cv::UMat) in the following code:

    for (int i = 0; i < N; ++i) {
        cv::extractChannel(img_vec[i], alpha_vec[i], 3);
        cv::cvtColor(img_vec[i], img_vec[i], CV_BGRA2BGR);
    }

Failure of the code in the fifth iteration immediately after launch cv::cvtColor(img_vec[i], img_vec[i], CV_BGRA2BGR).

Output message:

OpenCV error: statement failed (clEnqueueReadBuffer (q, (cl_mem) u-> handle, CL_TRUE, 0, u-> size, alignedPtr.getAlignedPtr (), 0, 0, 0) == CL_SUCCESS) on the map, file C: \ OpenCV-3.1.0 \ sources \ modules \ core \ src \ ocl.cpp, line 4758

This application requested Runtime to complete it in an Unusual way. Contact Support Information. termination of the call after calling the instance of 'cv :: Exception' what (): C: \ OpenCV-3.1.0 \ sources \ modules \ core \ src \ ocl.cpp: 4758: error: (-215) clEnqueueReadBuffer (q, (cl_mem ) u-> handle, CL_TRUE, 0, u-> size, alignedPtr.getAlignedPtr (), 0, 0, 0) == CL_SUCCESS in the function map

This only happens with large images (> 20Mp). The code works if I do not use TAPI ( cv::Mat) or disable OpenCL ( cv::ocl::setUseOpenCL(false)). I am using version 3.1.0.

Why is this so? Is there a way to make it work with GPU support?

+4
source share

All Articles