misleading error message in imshow() at empty image (Bug #2966)


Added by Alexander Kleinsorge almost 12 years ago. Updated over 11 years ago.


Status:Done Start date:2013-04-16
Priority:Normal Due date:
Assignee:Alexander Kleinsorge % Done:

0%

Category:highgui-images
Target version:2.4.6
Affected version:2.4.0 - 2.4.4 Operating System:
Difficulty: HW Platform:
Pull request:https://github.com/Itseez/opencv/pull/903

Description

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

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

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. ==>
window.cpp:void cv::imshow( const string& winname, InputArray _img )
'cvGetMat, file ..../OpenCV/opencv-2.4.4/modules/core/src/array.cpp, line 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.

OpenCV Error: Assertion failed (test.rows>0 && test.cols>0) in imshow, file ../modules/highgui/src/window.cpp, line 260

thanks


Associated revisions

Revision c9c09262
Added by Vadim Pisarevsky over 10 years ago

Merge pull request #2966 from PhilLab:patch-2

History

Updated by Anna Kogan almost 12 years ago

Hello Alexander,
If you could send a corresponding pull request in our GitHub repo, it would be highly appreciated!

  • Description changed from // file.cpp Mat1b test(0,0); cout << "imshow_now.." << ... to <pre> // file.cpp Mat1b test(0,0); cout << "imshow_now..&quo... More
  • Assignee changed from Vadim Pisarevsky to Alexander Kleinsorge

Updated by Alexander Kleinsorge almost 12 years ago

https://github.com/Itseez/opencv/pull/901
(3 trivial bugs together, only small trivial changes)

Updated by Alexander Kleinsorge almost 12 years ago

Anna Kogan wrote:

Hello Alexander,
If you could send a corresponding pull request in our GitHub repo, it would be highly appreciated!

could you have a look on my first pull request.
thanks, Alex

Updated by Vladislav Vinogradov over 11 years ago

Fix was merged into 2.4 branch.

Alexander, thanks for your participation.

  • Estimated time deleted (0.50)
  • Status changed from Open to Done
  • Pull request set to https://github.com/Itseez/opencv/pull/903

Also available in: Atom PDF