using C++ opencv on ubuntu : cvCaptureFromAVI() doesn't work

admin

Administrator
Staff member
I'm trying to use OpenCV library on pandaboard ubuntu 12.04.

So I installed Opencv2.4.2 version and the code is beneath.

Code:
#include <stdio.h>
#include <stdlib.h>
#include "opencv2/opencv.hpp"

int main*int argc, char** argv)
{
    cvNamedWindow("origin", CV_WINDOW_AUTOSIZE);

    CvCapture *capture = cvCaptureFromAVI("hkleecv-desktop:/home/hkleecv/OpenCV-2.4.2/samples/cpp/captured.avi");

    IplImage *frameOrigin;

    if(!capture0 return 1;

    int key = 0;
    int fps = (int)cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);

    while(key != 'q')
    {
        frameOrigin = cvQueryFrame(capture);

        cvShowImage("origin", frameOrigin);

        key = cvWaitKey(1000/fps);
    }

cvReleaseCapture(&capture);

    cvDestroyWindow("origin");

}

The problem is this program can't grab frames from the avi file.
(this code worked well on VS2010 C++)

when I run the program on the shell with gdb, it just return message "Inferior 1 (process nnnn) exited with code 01"

I googled about this error and found a page posted by someone who had similar problem as me, but cvCaptureFromAVI() isn't working currently.

<ul>
<li><a href="http://cellprogramming.wordpress.com/2009/05/24/opencv-cvcapturefromavi-error-in-ubuntu-9-04/" rel="nofollow">http://cellprogramming.wordpress.com/2009/05/24/opencv-cvcapturefromavi-error-in-ubuntu-9-04/</a></li>
<li><a href="http://gijs.pythonic.nl/blog/2009/may/3/getting-video-io-working-opencv-and-ubuntu-jaunty-/" rel="nofollow">http://gijs.pythonic.nl/blog/2009/may/3/getting-video-io-working-opencv-and-ubuntu-jaunty-/</a></li>
</ul>

can someone tell me what can I do from here to make cvaptureFromAVI() work?