Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

imshow: Assertion failed (size.width>0 && size.height>0)

Hey guys, here's the next error I encountered ... When I tried this code to test the installation:

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

using namespace cv;

int main()
{
    Mat image;// new blank image
    image = cv::imread("C:\\Users\XYZ\Documents\CodeBlocks\Projekte\Test\test.png", 0);// read the file
    namedWindow( "Display window", WINDOW_NORMAL );// create a window for display.
    imshow( "Display window", image );// show our image inside it.
    waitKey(0);// wait for a keystroke in the window
    return 0;
}

I get this error inside the app console:

OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file C :\OpenCV\opencv\sources\modules\highgui\src\window.cpp, line 279 terminate called after throwing an instance of 'cv::Exception' what(): C:\OpenCV\opencv\sources\modules\highgui\src\window.cpp:279: error: ( -215) size.width>0 && size.height>0 in function imshow

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

Process returned 3 (0x3) execution time : 10.086 s Press any key to continue.

The image used is the stadart Win7 demo picture of a jellyfish renamed to test.png and put into the project folder.

I hope that someone can help me, maybe it's just a change from opencv 2 to 3 but I don't know.

My System is Win7, Code::Blocks 13.12 and OpenCV 3. Compiler is mingw.

NG Dr. Console

imshow: Assertion failed (size.width>0 && size.height>0)

Hey guys, here's the next error I encountered ... When I tried this code to test the installation:

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

using namespace cv;

int main()
{
    Mat image;// new blank image
    image = cv::imread("C:\\Users\XYZ\Documents\CodeBlocks\Projekte\Test\test.png", 0);// read the file
    namedWindow( "Display window", WINDOW_NORMAL );// create a window for display.
    imshow( "Display window", image );// show our image inside it.
    waitKey(0);// wait for a keystroke in the window
    return 0;
}

I get this error inside the app console:

OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file C :\OpenCV\opencv\sources\modules\highgui\src\window.cpp, line 279 terminate called after throwing an instance of 'cv::Exception' what(): C:\OpenCV\opencv\sources\modules\highgui\src\window.cpp:279: error: ( -215) size.width>0 && size.height>0 in function imshow

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

Process returned 3 (0x3) execution time : 10.086 s Press any key to continue.

The image used is the stadart standart Win7 demo picture of a jellyfish renamed to test.png and put into the project folder.

I hope that someone can help me, maybe it's just a change from opencv 2 to 3 but I don't know.

My System is Win7, Code::Blocks 13.12 and OpenCV 3. Compiler is mingw.

NG Dr. Console