cv::findContours understanding.

asked 2013-12-03 08:33:06 -0500

Rogeeeer gravatar image

updated 2013-12-03 09:23:46 -0500

Hi,

I'm trying to create a marker detector, and I need to use findContours(). Original code :

std::vector<std::vector<cv::Point>> contours;
cv::findContours(thresholdImg, contours_, CV_RETR_LIST, CV_CHAIN_APPROX_NONE);

I have access violation with this one. So I looked in the code, and I have an error in contours.cpp:1720 when OpenCV try to call create on the OutputArray in the arguments. std::vector.create() doesn't exists. So I tried to give it a matrix to see :

cv::Mat contours;
cv::findContours(thresholdImg, contours_, CV_RETR_LIST, CV_CHAIN_APPROX_NONE);

The create step is OK, but in contours.cpp:1726 I have an error and with the debugger the function from matrix.cpp:1391 is used instead of the one in matrix.cpp:1363. So the assert is not respected because arguments are not the same.

It seems to be an internal problem of OpenCV, maybe my configuration is not good ? I already created a working project for face detection (but without findContours).

Environment : Windows 7 64bits, Visual Studio 2010, OpenCV 2.4.9

I'm using 2.4.9 because i needed a function not implemented in previous versions.

Edit :

Using 2.4.7 instead of 2.4.9 solve the problem.

edit retag flag offensive close merge delete

Comments

1

why is your vector called "contours", but you use "contours_" in your code ?

berak gravatar imageberak ( 2013-12-03 08:37:44 -0500 )edit

copy/paste error.

Rogeeeer gravatar imageRogeeeer ( 2013-12-03 09:00:36 -0500 )edit