Debug Assertion Error when detecting object and scene points in OpenCV

asked 2019-11-08 08:08:20 -0500

Dimitar Veljanovski gravatar image

I am trying to extract the query and train keypoints and generate a homography in OpenCV. I am doing that using the following block of code:

//Object and Scene are both vector<vector<Point2f>, and H is a cv::Mat. 
//keypoints 1 and 2 are both vector<cv::keypoints>
//good_matches are vector<cv::DMatches>
for (size_t i = 0; i < good_matches.size(); i++)
{
    try {
        object.push_back(keypoints1[good_matches[i].queryIdx].pt);
        scene.push_back(keypoints2[good_matches[i].trainIdx].pt);
    }
    catch (cv::Exception & e) {
        std::cout << e.msg << std::endl;
    }
}

The goal is to generate a homography:

H = findHomography(object, scene, cv::RANSAC);

But whenever I feed the camera a blurry frame, it throws an error window:

Debug Assertion Error
File: debug_heap.cpp (line 996)
Expression: __acrt_first_block == header

I first thought that im trying to access an undefined/cleared variable on the heap but that is not the case (after some single step debugging).

I did some research online and people said that this error is caused by libs, and the solution is to use the release libs in debug mode but that doesnt even compile in my case, and the file that is referenced - opencv_world411.lib doesnt exist in my Cmake build.

edit retag flag offensive close merge delete