/* Demo program to open and display an image file in OpenCV. J.K. Johnstone */ #include // these two OpenCV libraries should be included #include // in any OpenCV program #include using namespace std; int main (int argc, char **argv) { if (argc != 2) { cout << "Need an image parameter (jpg or ppm/pgm)" << endl; exit(-1); } IplImage *img = cvLoadImage (argv[1]); cvNamedWindow ("OpenCV demo", 1); cvShowImage ("OpenCV demo", img); // 1st parameter is the window cvWaitKey (0); // wait for a keystroke before releasing image/window cvDestroyWindow("foo"); // what is this parameter for? cvReleaseImage (&img); return 0; }