Heap-Error with findContours

asked 2013-05-15 12:34:36 -0500

George123 gravatar image

updated 2013-05-15 12:39:03 -0500

berak gravatar image

When I try function findContours() I get the Run-Error: "Debug Assertion Failed! ... File:f:\dd\vctools\crt_bld\self_x86\crt\src\dbgheap.c Line:1322 ... Expression:_CrtIsValidHeapPointer(pUserData) ..."

My Code is very simple:

  src = imread("D:/A1/auto5.jpg", 1 );
  cvtColor( src, src_gray, COLOR_BGR2GRAY );
  blur( src_gray, src_gray, Size(3,3) );
  Mat canny_output;
  vector<vector<Point> > contours;
  vector<Vec4i> hierarchy;
  Canny( src_gray, canny_output, thresh, thresh*2, 3 );
  findContours( canny_output, contours, hierarchy, RETR_TREE, CHAIN_APPROX_SIMPLE, Point(0, 0) );*

I'am using MS Visual Studio 2012

Any ideas?

edit retag flag offensive close merge delete

Comments

1

Looks good to me - just a note: shouldn't it be CV_RETR_TREE and CV_CHAIN_APPROX_SIMPLE? Which OpenCV version do you use?

Guanta gravatar imageGuanta ( 2013-05-15 15:46:17 -0500 )edit
1

must be github master(2.4.9), they've been skipping most of the CV_* prefixes there lately ( also COLOR_BGR2GRAY instead of CV_BGR2GRAY)

berak gravatar imageberak ( 2013-05-15 15:58:13 -0500 )edit

@berak: Cool! Good to know! @George123: Can you try running your code with the stable 2.4.5 version?

Guanta gravatar imageGuanta ( 2013-05-15 16:03:31 -0500 )edit