Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

video reading

Hi, I wanto to read a simple video file. Code is below, but i can not read the video file and always the compiler break the loop at the first step by the code if(!frame) break; where may i doing mistake? Thanks.

include <stdio.h>

include <opencv\cv.h>

include <opencv\highgui.h>

include <math.h>

include <iostream>

using namespace cv; using namespace std;

int main(int argc, char* argv) { CvCapture cap = cvCreateFileCapture("a.avi");

IplImage* img =0;
cvNamedWindow("a",CV_WINDOW_AUTOSIZE);


while(1){
    img = cvQueryFrame(cap);
    if(!img)
        break;

    cvShowImage("a",img);

    cvWaitKey(44);

}

cvWaitKey(0);
return 0;

}

video reading

Hi, I wanto to read a simple video file. Code is below, but i can not read the video file and always the compiler break the loop at the first step by the code if(!frame) break; where may i doing mistake? Thanks.

include <stdio.h>

include <opencv\cv.h>

include <opencv\highgui.h>

include <math.h>

include <iostream>

using namespace cv; using namespace std;

int main(int argc, char* argv) { CvCapture cap = cvCreateFileCapture("a.avi");

IplImage* img =0;
cvNamedWindow("a",CV_WINDOW_AUTOSIZE);


while(1){
    img = cvQueryFrame(cap);
    if(!img)
        break;

    cvShowImage("a",img);

    cvWaitKey(44);

}

cvWaitKey(0);
return 0;

}