Mercurial Hosting > traffic-intelligence
view 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 |
line wrap: on
line source
#include "cvutils.hpp" #include "opencv/cv.h" #include "opencv/highgui.h" #include <iostream> #include <ctime> using namespace std; int main(int argc, char *argv[]) { //cout << "Hello World" << endl; CvCapture *inputVideo = cvCaptureFromFile(argv[1]); IplImage* frame = cvQueryFrame(inputVideo); //IplImage* bwFrame = allocateImage(frame->width, frame->height, IPL_DEPTH_8U, 1); int frameNum = 0; time_t seconds; time_t t0 = time(NULL); while (frame) { if (frameNum%1000 == 0) { seconds = time(NULL)-t0; cout << frameNum << " " << seconds << endl; } // cvConvertImage(frame, bwFrame); // for (int i=0; i<frame->height; ++i) // for (int j=0; j<frame->width; ++j) // int gray = cvGetReal2D(bwFrame, i, j); frame = cvQueryFrame(inputVideo); frameNum++; } return 1; }