Updated by Anna Kogan almost 12 years ago

<pre>
// file.cpp
Mat1b test(0,0);
cout << "imshow_now.." << endl;
//CV_Assert(test.rows>0 && test.cols>0);
imshow("EMPTY", test); // will crash
</pre>
<pre>


imshow_now..
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file ..../OpenCV/opencv-2.4.4/modules/core/src/array.cpp, line 2482
terminate called after throwing an instance of 'cv::Exception'
what(): ..../OpenCV/opencv-2.4.4/modules/core/src/array.cpp:2482: error: (-206) Unrecognized or unsupported array type in function cvGetMat
</pre>


Having a huge program and suddenly this message appears, makes you wonder.
Putting the CV_Assert into imshow() makes it easier and faster to understand. ==> <pre>window.cpp:void window.cpp:void cv::imshow( const string& winname, InputArray _img )
'cvGetMat, file ..../OpenCV/opencv-2.4.4/modules/core/src/array.cpp, line 2482'</pre> 2482' also happens in imageproc_functions and could be caused by anything, everywhere.
imshow() is not that time critical, to save this CV_Assert.

OUTPUT, which would be more user friendly.
<pre>
OpenCV Error: Assertion failed (test.rows>0 && test.cols>0) in imshow, file ../modules/highgui/src/window.cpp, line 260
</pre>


thanks

Back