Ask Your Question

Revision history [back]

Exception deep inside OpenCV code

I am writing code to perform background subtraction. The relevant part of the code is:

cv::Mat     fg_mask;                    // Foreground mask generated by MOG2 method
cv::Ptr<cv::BackgroundSubtractor> mog2; // MOG2 background subtractor
mog2 = cv::createBackgroundSubtractorMOG2();

// Start processing the video

while ( ( frame ) )
#ifdef _DEBUG
    std::cout << frame_num << '\n';

    cv::Mat gray;
    cv::cvtColor ( frame, gray, cv::COLOR_BGR2GRAY );
    mog2->apply ( gray, fg_mask ); 

As I start to execute the code, I get an exception thrown from inside ocl.cpp from the statement:

CV_OclDbgAssert(clEnqueueUnmapMemObject(q, (cl_mem)u->handle, data, 0, 0, 0) == CL_SUCCESS);


-       cstr_   0x00ed9d04 "..\..\opencv\sources\modules\core\src\ocl.cpp:4446: error: (-215) clEnqueueUnmapMemObject_pfn(q, (cl_mem)u->handle, data, 0, 0, 0) == 0 in function cv::ocl::OpenCLAllocator::deallocate"

I am able to run this in a standalone application but the integration is causing me headaches. The exception is thrown from a deallocation function which is weird. Just wondering if anyone has come across such error.