OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file .../opencv/modules/highgui/src/window.cpp, line 276
and the image shown was gray.
The code is:
include <opencv\cv.h>
include <opencv\highgui.h>
using namespace cv;
int main(int argc, char* argv) { IplImage img = cvLoadImage( "C:\Users\elala mobile\Documents\Visual Studio 2010\Projects\opencv\opencv\mypic.png" ); //change the name (image.jpg) according to your Image filename. cvNamedWindow( "Example1", CV_WINDOW_NORMAL ); cvShowImage("Example1", img); cvWaitKey(0); cvReleaseImage( &img ); cvDestroyWindow( "Example1" ); return 0; }
What's the cause of this error?