I have been having some problems with using Open CV to play an avi file.
I am currently creating a eye input based system, where the mouse is replaced by an eye tracker. I am currently working on flat .csv files, and importing the coordinates then using those coordinates to do various tasks on the screen.
These coordinates have been recorded using a real eye tracker which creates two files, a .csv file of the coordinates of they eye movement and an avi file.
In essence what i am trying to achieve is to run the video in tandem with my self created code for the processing of the moues movements.
I have been advised to use Open CV for this, however i cannot seem to find a tutorial that shows me how to process an avi file and play it. This is very frustrating as i have seen many people comment on the ease of OpenCV yet i can't find any examples which aren't overly complicated! The file in question is named "test_00003.avi"
Leaving my rant behind :) I was hoping i may be able to open my question to a wider audience who may be able to help me in understanding how to create a simple, full screen avi player.
Kind Regards,
David
PS for additional information, I am currently using XP, Using Visual C++
Here is my code that i have attempted to make work :D
Expand|Select|Wrap|Line Numbers
- CvCapture* capture = 0;
- IplImage *frame, *frame_copy = 0;
- static CvMemStorage* storage = cvCreateMemStorage(0);
- capture = cvCaptureFromAVI( "test_00003.avi" );
- cvNamedWindow( "Picture:", 1 );
- if( capture )
- {
- for(;;)
- {
- if( !cvGrabFrame( capture ))
- break;
- frame = cvRetrieveFrame( capture );
- if( !frame )
- break;
- if( !frame_copy )
- frame_copy = cvCreateImage(
- cvSize(frame->width,frame->height),
- IPL_DEPTH_8U,
- frame->nChannels );
- if( frame->origin == IPL_ORIGIN_TL )
- cvCopy( frame, frame_copy, 0 );
- else
- cvFlip( frame, frame_copy, 0 );
- cvShowImage("Picture:",frame_copy);
- // Varying this will vary the speed of the avi file
- if( cvWaitKey( 20 ) >= 0 )
- break;
- }
- cvReleaseImage( &frame_copy );
- cvReleaseCapture( &capture );
- }
- cvClearMemStorage( storage );
- cvDestroyWindow("Picture:");
- }