Ask Your Question

Something funky in the drawing functions? 2.4.8 VS2012

asked 2014-03-25 00:08:02 -0500

pistorinoj gravatar image

I am wondering if other folks are experiencing something funky in the drawing functions in 2.4.8 using VS2012 c++/cli.

Previously, in 2.4.6, I was using the line function in spots with no problems. Then, I switched to 2.4.8, and the exact same line function started crashing for no apparent reason. I never figured it out.

Now, I am trying to use drawcontours and, depending on the line width, the code crashes.

The following line works.

for(unsigned int i = 0; i < ContoursList.size(); i++ )
    drawContours( AnalysisFrame, ContoursList , i, color, CV_FILLED, 8);

However, if I replace CV_FILLED with an integer like 1 or 2 (for a line width), it crashes. Thus,

 drawContours( AnalysisFrame, ContoursList , i, color, 2, 8);


Anyone else experiencing these problems with the drawing functions?

Thanks for any help.

edit retag flag offensive close merge delete


Actually, using an integer for line width seems to work perfectly here ... sure you haven't made a typo somewhere? What is the error generated in debugging mode?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-03-25 05:42:33 -0500 )edit

Actually, why are you using an unsigned integer to loop through the contours? You would prefer a signed integer right there...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-03-25 05:49:04 -0500 )edit

for the "unsigned" issue, I was getting a warning that I was comparing a signed with an unsigned in the for loop because ContoursList.size() returns an unsigned number. It was not an error but I changed it to get rid of the warning since that shouldn't matter. In any event, switching between signed and unsigned here has no efftect.

With more tracking, I can see that it appears to be the same error as I previously posted on the line function because drawcontours calls "thickline" in drawing.cpp. When you run this, you crash getting an error saying "Run Time Check Failure #2 - Stack around the variable 'center' was corrupted." which appears to be on the last line of thickline in drawing.cpp. Previously, I moved the line function to the first line of my code and still got this error.

pistorinoj gravatar imagepistorinoj ( 2014-03-25 09:13:41 -0500 )edit

Then please explain to me why 2.4.8 is working on my system here :)?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-03-25 09:16:41 -0500 )edit

Is it possible that it is the same error as was reported for ellipse? That seems like it was found in 2.4.6.

pistorinoj gravatar imagepistorinoj ( 2014-03-25 10:02:37 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-04-20 20:08:44 -0500

pistorinoj gravatar image

I tracked this down I guess in that I think it must have been a linking error. I recompiled OpenCV and that made this error go away. Could have been a 32 v. 64 bit issue.

edit flag offensive delete link more


Do accept your own answer as solution, so that this appears solved!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-22 03:28:51 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2014-03-25 00:08:02 -0500

Seen: 160 times

Last updated: Apr 20 '14