#include "cv.h"
#include "highgui.h"
int main(int argc, char** argv)
{
CvCapture* capture=0;
IplImage* frame=0;
capture = cvCaptureFromAVI("C:\\boy walking back.avi");
if( !capture )
throw "Error when reading steam_avi";
cvNamedWindow( "w", 1);
for( ; ; )
{
frame = cvQueryFrame( capture );
if(!frame)
break;
cvShowImage("w", frame);
}
cvWaitKey(0);
cvDestroyWindow("w");
cvReleaseImage(&frame);
}
I am using openCV with VS2008. I read in the video file and used CV_CAP_PROP_FRAME_COUNT to get the number of frames, which was about 130 for a 4 second video clip. I do walking motion recognition, so I need to get all the other 5 frames, because between 5 frames, there is a slight change in body movement. So far I have a program that allows me to get one frame of a video clip. However, I cannot get different frames, and also, I'm not sure how to get all the other 5 frames. The above code is used to get one frame of video.
source
share