comparison c/optical-flow.cpp @ 10:068cf45c3f1b

added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
author Nicolas Saunier <nico@confins.net>
date Mon, 09 Nov 2009 01:56:25 -0500
parents
children e77e2fd69b02
comparison
equal deleted inserted replaced
9:eb38637f338d 10:068cf45c3f1b
1 #include "cvutils.hpp"
2
3 #include "opencv/cv.h"
4 #include "opencv/highgui.h"
5
6 #include <iostream>
7 #include <ctime>
8
9 using namespace std;
10
11
12 int main(int argc, char *argv[]) {
13 //cout << "Hello World" << endl;
14
15 CvCapture *inputVideo = cvCaptureFromFile(argv[1]);
16
17 IplImage* frame = cvQueryFrame(inputVideo);
18 //IplImage* bwFrame = allocateImage(frame->width, frame->height, IPL_DEPTH_8U, 1);
19
20 int frameNum = 0;
21 time_t seconds;
22 time_t t0 = time(NULL);
23 while (frame) {
24 if (frameNum%1000 == 0) {
25 seconds = time(NULL)-t0;
26
27 cout << frameNum << " " << seconds << endl;
28 }
29 // cvConvertImage(frame, bwFrame);
30
31 // for (int i=0; i<frame->height; ++i)
32 // for (int j=0; j<frame->width; ++j)
33 // int gray = cvGetReal2D(bwFrame, i, j);
34
35 frame = cvQueryFrame(inputVideo);
36 frameNum++;
37 }
38
39 return 1;
40 }