Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Accessing Mat causes crash

I tried to make a simple image loading test and displaying it on a window using the imshow method and it crashed. Then I tried to narrow the problem down to a simpler example like the following:

Mat C = (Mat_<double>(3,3) << 0, -1, 0, -1, 5, -1, 0, -1, 0);
cout << "C = " << endl << " " << C << endl << endl;

It gave me an an assertion failure:

    OpenCV Error: Assertion failed <0 <= d && d <= CV_MAX_DIM && _sizes) in create, file C:/slave/builds/WinInstallerMegaPack/src/opencv/modules/core/src/matrix.cpp, line 187 terminate called after throwing an instance of 'cv::Exception'
 what(): C:/slave/builds/WinInstallerMegaPack/src/opencv/modules/core/src/matrix.cpp:187: error: (-215) 0 <= d && d <= CV_MAX_DIM && _sizes in function create

I'll have to resort to using the "C" part of the OpenCV library, but I would like to now how I can get Mat working so I could use C++.

I'm using Code::Blocks 12.11 and OpenCV 2.4.5