Ask Your Question

Gazoo's profile - activity

2016-03-28 14:43:48 -0500 answered a question FindContours() causing heap corruption on VS2013?

While I'm no expert, I feel fairly confident that there is something amiss with OpenCV running on Visual Studio 2013 and using FindContours (C++).

I've made use of the C implementation as a substitute which works without a hitch.

So... Bugger, I guess? I should look into adding it as a bug.

2016-03-26 12:05:52 -0500 commented question FindContours() causing heap corruption on VS2013?

Hey berak, thanks for the comment. I've just looked things over, and unless linking with libs found in the vc12 folder (which as far as I know is actually Visual Studio 2013) is wrong, then I think all the linking is correct. Given that the pre-compiled binaries for OpenCV 3.1 are x64 only, I've paid particular attention to proper linking. Additionally, I can without any issue use OpenCV's other functionality, like cv::solvePnP, so I'm fairly convinced it's not a linker issue.

2016-03-26 11:55:13 -0500 asked a question FindContours() causing heap corruption on VS2013?

Hey fellow forum-goers,

I ran into some trouble with FindContours() in OpenCV 3.0 and OpenCV 3.1 using Visual Studio 2013. At first I assumed I am at fault (and I'm not entirely unsure that I've not messed up somewhere still), but I'm slowly beginning to wonder if perhaps FindContours() actually does cause heap corruption?

The following straight forward code seems to cause heap corruption for me:

std::vector<std::vector<cv::Point> > contours;
cv::Mat inp( cv::Size( 400, 400 ), CV_8UC1 );
cv::findContours( inp, contours, CV_RETR_LIST, CV_CHAIN_APPROX_NONE );

I use Cinder at a framework for lots of my coding, but given its robust history, I'd be surprised if anything in an empty skeleton setup would interfere with the OpenCV code I've posted above. This code run on its own causes this error in Vs2013:

Debug Assertion Failed!

Program: D:\Code\FindContoursTest\vc2013\x64\Debug\FindContoursTest.exe
File: f:\dd\vctools\crt\crtw32\misc\dbgheap.c
Line: 1424

Expression: _pFirstBlock == pHead

I've found numerous posts regarding the use (or rather misuse) of OpenCV, and perhaps something is bad with the code above, but as far as I've been able to ascertain, it certainly shouldn't cause any heap corruption. I came across this post by lowlander256 who claims that it is indeed an issue in OpenCV.

Perhaps someone can help me at least figure out if the isolated code above should run fine?

Regards,

Gazoo