Hello all!

I am having a bit of a problem with the grasps of Open CV and thought i may be able to request some of your help. Though I'm not completely sure that this is the right category.

I have been playing around with openCV to try and provide a way in which i can create a full screen light avi player. In essence, i am using eye input to control a mouse moving, this works all nicey nicey, however there is a video that accompanies the eye tracking coordinated and thought it would be quite neat if i could have it running in tandem. Hence i started to use OpenCV (with recommendation from my peers).

I have come to a bit of a stop point though, i can load a single image in, but when i come to use the cvCaptureFromAVI control.

I have been given some code to play with (with my additions(, however for the life of me i cannot seem to get it to work.

int _tmain(int argc, _TCHAR* argv[])
	    CvCapture* capture = 0;
    IplImage *frame, *frame_copy = 0;
    static CvMemStorage* storage = cvCreateMemStorage(0);

    capture = cvCaptureFromAVI( "test_00003.avi" );

    cvNamedWindow( "Picture:", 1 );

    if( capture )
            if( !cvGrabFrame( capture ))
            frame = cvRetrieveFrame( capture );
            if( !frame )
            if( !frame_copy )
                frame_copy = cvCreateImage(
frame->nChannels );
            if( frame->origin == IPL_ORIGIN_TL )
                cvCopy( frame, frame_copy, 0 );
                cvFlip( frame, frame_copy, 0 );

            // Varying this will vary the speed of the avi file
            if( cvWaitKey( 20 ) >= 0 )

        cvReleaseImage( &frame_copy );
        cvReleaseCapture( &capture );

    cvClearMemStorage( storage );   

Obviously the .avi file can and should be variable. This (non-working) solution is only a windowed version, is better than nothing but I am really after a full screen version, as that would match the resolution better to the information obtained by the eye tracker.

As i said previously I am not completely sure that I have entered this post in the right forum, but you guys are usually quite helpful and will pass me in the right direction if I am wrong! Has anyone got any examples of playing AVI files with OpenCV, all the example i find on the internet don't seem fit for purpose and are generally over complicated with addition features and GUI's that is hard to decipher. Any help will be extremely appreciated,

Kind Regards,

8 Years
Discussion Span
Last Post by megamanexp

Try by copying the avi file into the directory where the code exists.

This thread is almost 3 months old, so I guess the OP solved the problem already.

But just in case the OP is still interested in the answer:

however for the life of me i cannot seem to get it to work.

What doesn't work? Does it compile?



as that would match the resolution better to the information obtained by the eye tracker.

Kind Regards,

Dear David,

I am working on Opencv as well and is working with face detection .I want to do eye tracking and also detect the blink of eyes.Could you please guide me.


Hi there,

i am also currently working a project on the face detection using OpenCV but is using the Borland C++ to do the programming is there any different??? If not could anyone guide me i need help thank you and if possible can anyone send a example file that working for me to practice so that i could at least explain how the thing work.

Best regards

Don't bump old threads
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.