Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Assertion faild error on OpenCV3.3.0

I had this exact error message on windows 10 with VS2017 and OpenCV3.3.0 and couldn't find a solution. so switched to Ubuntu 16.04 and tried OpenCV3.3.0 with codeblocks. but I got the same error again!!

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

Aborted (core dumped)

Should I remove OpenCV3.3.0 and install 3.2.0 ?

Assertion faild error on OpenCV3.3.0

I had this exact error message on windows 10 with VS2017 and OpenCV3.3.0 and couldn't find a solution. so switched to Ubuntu 16.04 and tried OpenCV3.3.0 with codeblocks. but I got the same error again!!

My code:

#include <iostream>
#include <opencv2/opencv.hpp>



using namespace std;
using namespace cv;

int main()
{

    Mat img=imread("home/m/1.jpg");
    namedWindow("image", WINDOW_AUTOSIZE);
    imshow("image", img);
    waitKey(0);
    return 0;
}

The error message:

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

Aborted (core dumped)

Should I remove OpenCV3.3.0 and install 3.2.0 ?