mayanktalwar 0 Newbie Poster

open cv

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

    int main()
    {
    cvNamedWindow( "Example2", CV_WINDOW_AUTOSIZE );
    CvCapture* capture = cvCreateFileCapture( "a.avi" );
    IplImage* frame;
    if(!capture)
    {
        printf("fail");
    }
    else{

    while(1) {
    frame = cvQueryFrame( capture );
    if( !frame ) break;
    cvShowImage( "Example2", frame );
    char c = cvWaitKey(33);
    if( c == 27 ) break;
    }
    cvReleaseCapture( &capture );
    cvDestroyWindow( "Example2" );}
    return 0;
    }

i have tried with above code to play a avi file with open cv but only a grey window named  example2 appears and after that it goes away what more libararies are needed for this