Ask Your Question
0

Bug in line function in 2.4.8?

asked 2014-03-07 00:26:35 -0600

pistorinoj gravatar image

updated 2014-03-07 11:17:40 -0600

I am running VS2012 c++/cli on Win 8.1 64 bit.

I recently updated my libraries from version 2.4.6 to 2.4.8. Previously, I had a series of functions that called the line function and those were working perfectly (or at least I never saw this problem).

Now, I updated to 2.4.8 and what I thought were simple functions are crashing at run time.

In particular, the following code is causing a crash:

cv::Mat Frame;
Frame = cv::imread("Testfile.png");
cv::line(Frame,cv::Point(0,375),cv::Point(999,375),CV_RGB(200,0,0),1,8,0);

Frame is a Mat that has 1000 columns and 750 rows.

When I run this, I get an error saying "Run Time Check Failure #2 - Stack around the variable 'pt' was corrupted."

It is pointing me to the last line of the function "ThickLine" in the file drawing.cpp.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2014-04-20 20:07:39 -0600

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
0

answered 2014-03-07 00:58:20 -0600

updated 2014-03-07 01:02:33 -0600

There is an error with your code: if the Mat has 1000 columns so how to reach to 1000 index value in cv::Point(1000, 375)? The max value for x index in this case is 999.

edit flag offensive delete link more

Comments

Thanks but that does not appear to be it. First, I change the line to refer to less than 1000 columns and still got an error. Also, I did not change this code between 2.4.6 and 2.4.8 and only started seeing this error in 2.4.8.

pistorinoj gravatar imagepistorinoj ( 2014-03-07 09:10:22 -0600 )edit

Could you post more code that I can reproduce? The code contains input operation for 'pt' variable may have some problems.

tuannhtn gravatar imagetuannhtn ( 2014-03-07 09:36:37 -0600 )edit

Thanks. I just added more code to the post. For debugging, I have moved that code to the first lines of the entire program and am still seeing an error. Thanks for your help.

pistorinoj gravatar imagepistorinoj ( 2014-03-07 10:06:17 -0600 )edit

Did you link your program to correct vc11 folders of OpenCV (.lib and .dll files, Debug mode and Release mode builds)?

tuannhtn gravatar imagetuannhtn ( 2014-03-07 10:16:03 -0600 )edit

No. pt is a variable in the drawing.cpp file that is part of OpenCV.

pistorinoj gravatar imagepistorinoj ( 2014-03-07 10:53:38 -0600 )edit

Question Tools

Stats

Asked: 2014-03-07 00:26:35 -0600

Seen: 373 times

Last updated: Apr 20 '14