annotate c/optical-flow.cpp @ 11:e77e2fd69b02

modularized code (not compiling)
author Nicolas Saunier <nico@confins.net>
date Wed, 11 Nov 2009 12:01:43 -0500
parents 068cf45c3f1b
children ff5403319cec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
1 #include "cvutils.hpp"
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
2
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
3 #include "opencv/cv.h"
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
4 #include "opencv/highgui.h"
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
5
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
6 #include <iostream>
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
7 #include <ctime>
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
8
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
9 using namespace std;
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
10
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
11
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
12 int main(int argc, char *argv[]) {
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
13 //cout << "Hello World" << endl;
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
14
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
15 CvCapture *inputVideo = cvCaptureFromFile(argv[1]);
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
16
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
17 IplImage* frame = cvQueryFrame(inputVideo);
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
18 //IplImage* bwFrame = allocateImage(frame->width, frame->height, IPL_DEPTH_8U, 1);
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
19
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
20 int frameNum = 0;
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
21 time_t seconds;
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
22 time_t t0 = time(NULL);
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
23 while (frame) {
11
e77e2fd69b02 modularized code (not compiling)
Nicolas Saunier <nico@confins.net>
parents: 10
diff changeset
24 ::goToFrameNum(capture, frameNum, frameNum+1000);
e77e2fd69b02 modularized code (not compiling)
Nicolas Saunier <nico@confins.net>
parents: 10
diff changeset
25 seconds = time(NULL)-t0;
10
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
26
11
e77e2fd69b02 modularized code (not compiling)
Nicolas Saunier <nico@confins.net>
parents: 10
diff changeset
27 cout << frameNum << " " << seconds << endl;
10
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
28
11
e77e2fd69b02 modularized code (not compiling)
Nicolas Saunier <nico@confins.net>
parents: 10
diff changeset
29 frameNum+=1000;
10
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
30 }
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
31
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
32 return 1;
068cf45c3f1b added optical flow skeleton (test to reach a frame with cvqueryframe (fast for small resolutions)
Nicolas Saunier <nico@confins.net>
parents:
diff changeset
33 }