OpenCV : Displaying an Image

Here is a Sample application to display an image.


Download the Project folder and the source code.



//______________________________________________________________________________________
// OpenCV Demo Program
// Author: Bharath Prabhuswamy
//______________________________________________________________________________________
//______________________________________________________________________________________

#include "cv.h"
#include "highgui.h"
#include <stdio.h>

int main()
{
 
    cvNamedWindow( "image", CV_WINDOW_AUTOSIZE);

 /* Load an Image from the disk */
 IplImage* img  = cvLoadImage("things.jpg");
 
 /* Always check if the program can find the file */
 if( !img )
  return -1;
 
 /* Display the image in the window named "image" */
    cvShowImage( "image", img );
    cvWaitKey(0);

 /* Clean up memory */
    cvDestroyWindow( "image" );
    cvReleaseImage( &img );
    return 0;
}

1 comment:

  1. Would you post "how to use 'SyntaxHighlighter' in wordpress.com blog" .I saw
    http://alexgorbatchev.com/SyntaxHighlighter
    and found that my wordpress blog doesn't has "plugin" option in admin dashboard.

    ReplyDelete