Assertion failed (u->origdata == data) in deallocate, using OpenCL

asked 2017-09-20 10:46:47 -0600

Major Squirrel gravatar image

Hello everyone,

I am trying to use OpenCL (OpenCV 3.3) on a Hummingboard i.MX6 which supports OpenCL 1.1 EP.

I've created a small program that tests the color conversion function from OpenCV, using OpenCV and using OpenCL.

void    performOpenCL(const std::string &imagePath, bool useOpenCL)
{
    cv::Mat     image;
    cv::UMat    output(cv::USAGE_ALLOCATE_HOST_MEMORY);

    cv::ocl::setUseOpenCL(useOpenCL);
    image = cv::imread(imagePath);
    cv::cvtColor(image, output, cv::COLOR_BGR2HLS);
}

Here is the error :

image description

Has anyone experienced this before ? I'm getting exhausted because I don't really know where this can come from. Also, I don't know how to interpret the error lines : do the line starting with (9xx) come from OpenCL or OpenCV ?

Here is the OpenCV GitHub reference : https://github.com/opencv/opencv/blob...

Thank you in advance for your help. :)

edit retag flag offensive close merge delete

Comments

1

imho, your input should be a UMat, too, also in the same memory as the output.

playing with variations of your code above, this approach solved it (it would segfault on win):

cv::UMat    image(cv::USAGE_ALLOCATE_HOST_MEMORY);
...
imread(imagePath).copyTo(image);
berak gravatar imageberak ( 2017-09-21 08:59:40 -0600 )edit

Hi @berak,

I modified my code with your pseudo-code :

void    performOpenCL(const std::string &imagePath, bool useOpenCL)
    {
        cv::UMat    image(cv::USAGE_ALLOCATE_HOST_MEMORY);
        cv::UMat    output(cv::USAGE_ALLOCATE_HOST_MEMORY);

        cv::ocl::setUseOpenCL(useOpenCL);
        cv::imread(imagePath).copyTo(image);
        cv::cvtColor(image, output, cv::COLOR_BGR2HLS);
    }

I don't have the assertion anymore, but I keep having the errors above (syntax error at 'unsigned', undefined identifier, etc). Do you know where it could from ?

Major Squirrel gravatar imageMajor Squirrel ( 2017-09-21 17:05:27 -0600 )edit

the print statements are from somewhere in the ocl module. it tries to precompile a lot of ocl kernels fo library functions, and somewhere, your ocl version does not meet the expectations.

(sorry for being so vague, i just don't know better)

berak gravatar imageberak ( 2017-09-22 01:54:28 -0600 )edit