cvRetrieveFrame crahses

Posted by pooh_bear on Stack Overflow See other posts from Stack Overflow or by pooh_bear
Published on 2012-10-31T16:58:19Z Indexed on 2012/10/31 17:00 UTC
Read the original article Hit count: 134

Filed under:
|

I'm trying to write a simple openCV code that create a capture and retrieves the first frame from it.

**CvCapture *m_pCapfile = cvCreateFileCapture(m_aviFileName.c_str());
if (m_pCapfile)
     m_frames = cvRound(cvGetCaptureProperty(m_pCapfile, CV_CAP_PROP_FRAME_COUNT));
cvSetCaptureProperty(m_pCapfile, CV_CAP_PROP_POS_FRAMES, 0);
int ret = cvGrabFrame( m_pCapfile);
IplImage *cap = cvRetrieveFrame( m_pCapfile);**

In m_frames is have 153, which is the correct number of frames as far as I know. cvGrabFrame returns 1 to ret however cvRetrieveFrame crashes.

I tries using cvCaptureFromFile and cvCaptureFromAVI instead of cvCreateFileCapture In both cases cvRetrieveFrame method crashes.

Any ideas?

Thanks

© Stack Overflow or respective owner

Related posts about c++

Related posts about opencv