OpenCV Video file Offset Problem

OpenCV is unable to open into video files with offset. Guess we have to do it ourselves.  The code which should take care of the offset is

/****************************************************************************/
#include <stdio.h>
#include <highgui.h>

int main()
{
CvCapture *video;
IplImage *im;
double wait;

cvNamedWindow(“Video”,1);
cvMoveWindow(“Video”,200,200);

video = cvCaptureFromFile(“/home/sysad/Misc/Snatch.avi”);
if(video==NULL)
{
abort();
}
cvSetCaptureProperty(video,CV_CAP_PROP_POS_AVI_RATIO,(double)0.75); // DOES NOT WORK CURRENTLY
im = cvQueryFrame(video);
wait = 1000.0/cvGetCaptureProperty(video,CV_CAP_PROP_FPS);

while(im!=NULL)
{
cvShowImage(“Video”,im);
cvWaitKey((int)wait);
im = cvQueryFrame(video);
}
cvReleaseCapture(&video);

return 0;
}

/************************************************************************/

The program however reads from the beginning of the file always. The simplest and most obvious  workaround is to keep a counter and skip processing files till you reach the one of your interest!

Advertisements
Post a comment or leave a trackback: Trackback URL.

Comments

  • music  On January 9, 2008 at 2:17 am

    very interesting.
    i’m adding in RSS Reader

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: