Heap memory corruption bug in C++ HoughLinesP function

asked 2015-10-13 10:26:08 -0600

In development environment of VS2010, opencv 2.4.11, Windows7-32bit, and an MFC GUI program, the HoughLinesP function always causes a heap memory corruption error in an automatic memory clearing stage of std::vector, even when a std::vector<vec4i> parameter is inputted as an OutputArray parameter of the function like the examples in the documentation. I could cope with this problem with difficulty by using the old cvHoughLines2 function where the output is an old CvSeq data structure. But I think this is unreasonable, and a newer version should address a major function bug of a pretty older version in a software. Could anyone address this problem? The Hough transform is one of much used basic functions in the vision field, as you know.

edit retag flag offensive close merge delete

Comments

1

i very much doubt, that this is an opencv bug, behaviour like this is usually due to incorrect linking on the user side. failing std::vectors or std::strings are usually a symptom of this.

MFC gui, hmmm. that might be problematic.

can you do a check, if you link against multithreaded dynamic c-runtime ? (/MD or /MDd)

are you strictly using debug libs in debug mode and release libs in release mode ?

also, please try to add a short code snippet, so other can try to reproduce this behaviour

berak gravatar imageberak ( 2015-10-13 10:29:07 -0600 )edit

Hi, berak, the same code works well in a console program in the same development environment without causing a heap corruption at the end of the program. In MFC gui programming, I used a debug library of opencv 2.4.11 and a static MFC library of VS2010 (/MD) because the dll version of the MFC causes more problems with opencv.

skdskim gravatar imageskdskim ( 2015-10-13 13:01:18 -0600 )edit

@skdskim - you've got your answer then, it is not an OpenCV bug

LorenaGdL gravatar imageLorenaGdL ( 2015-10-13 15:53:07 -0600 )edit