I have a multithreaded C ++ windows project in Visual Studio 2010 that uses Qt (5.1.1) and OpenCV (2.4.8). When I create it in Debug mode , everything works fine, but when I create it in Release mode , the program crashes. Both configurations are almost identical (only in the release βI have a multi-threaded DLL / MD and in the Debug Multi-threaded Debug DLL / MDd), I turned off the optimization for Release and even turned on debug to catch the error. The strangest thing is that the same fragment code that crashes works fine in another console project.
The error is internal to OpenCV code, it is not related to my code, my code is simple:
void MyProject::findEllipses(QImage &frame, vector<RotatedRect> &ellipses)
{
Mat image = Mat(frame.height(), frame.width(), CV_8UC4, frame.scanLine(0));
cvtColor(image, image, CV_RGB2GRAY);
GaussianBlur(image, image, Size(3, 3), 0, 0, 4);
threshold(image, image, treshVal, 255, THRESH_BINARY);
vector<vector<Point> > contours;
Mat contoursImage = image.clone();
findContours(contoursImage, contours, CV_RETR_LIST, CV_CHAIN_APPROX_NONE, Point(0, 0));
Debug, , findContours _contours.create(total, 1, 0, -1, true); ( 1720 OpenCV contours.cpp) .... , _contours.create(total, 1, 0, -1, true), , , void _OutputArray::clear() const ( 1674 of matrix.cpp) , int k = kind(); , cv::kind() :
int _InputArray::type(int i) const
{
int k = kind();
againg kind(), type() ( kind(), ), , .
Visual Studio 2010, , , .
, , , create(), , , . DLL OpenCV, , , , , . , , OpenCV.
, , , , , , .
EDIT:
, , .
:
https://app.box.com/s/3owljl44emv57erinrf8
, OpenCV 2.4.8 Qt 5.1.1 Visual Studio 2010, . , , 20 SaraVisualControl.cpp , , , . , , , .
2
: http://code.opencv.org/issues/2218 , , CMake OPENCV_CAN_BREAK_BINARY_COMPATIBILITY , , . OpenCV, http://code.opencv.org/issues/2358. - ?