I am working on a project with openCV 2.2. I need to process every frame of the AVI file, but when I run my code, it captures only the first frame of the file. CV_CAP_PROP_POS_FRAMES does not seem to work. Any ideas why not?
CvCapture* capture = cvCaptureFromAVI("test1.avi"); IplImage *img = 0; if (!cvGrabFrame(capture)) { printf("Error: Couldn't open the image file.\n"); return 1; } int numFrames = (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_COUNT); int posFrame = 1; for(int i =0; i <= numFrames; i++){ cvSetCaptureProperty(capture, CV_CAP_PROP_POS_FRAMES, i); posFrame = cvGetCaptureProperty(capture, CV_CAP_PROP_POS_FRAMES); img = cvGrabFrame(capture); cvNamedWindow("Image:", CV_WINDOW_AUTOSIZE); cvShowImage("Image:", img); printf("%i\n",posFrame); cvWaitKey(0); cvDestroyWindow("Image:"); }
c ++ opencv frames avi
Chris Mondiek May 13 '12 at 5:19 2012-05-13 05:19
source share