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 ?