Mercurial > hg > nsaunier > traffic-intelligence
comparison c/feature-based-tracking.cpp @ 179:4f10e97cb677
added getting first and last instant for each feature
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Mon, 31 Oct 2011 19:17:42 -0400 |
| parents | d7df8ecf5ccd |
| children | 3a4eef37384f |
comparison
equal
deleted
inserted
replaced
| 178:d7df8ecf5ccd | 179:4f10e97cb677 |
|---|---|
| 271 | 271 |
| 272 // main loop | 272 // main loop |
| 273 // TODO version que l'on peut interrompre ? | 273 // TODO version que l'on peut interrompre ? |
| 274 for (int frameNum = params.frame1; ((frameNum-params.frame1 < params.nFrames) || (params.nFrames < 0)); frameNum++) { | 274 for (int frameNum = params.frame1; ((frameNum-params.frame1 < params.nFrames) || (params.nFrames < 0)); frameNum++) { |
| 275 vector<int> trajectoryIds; | 275 vector<int> trajectoryIds; |
| 276 success = trajectoryDB->trajectoryIdStartingAt(trajectoryIds, frameNum); | 276 success = trajectoryDB->trajectoryIdStartingAt(trajectoryIds, frameNum); // ending |
| 277 cout << "frame " << frameNum << " " << success << endl; | 277 cout << "frame " << frameNum << " " << success << endl; |
| 278 cout << trajectoryIds.size() << " trajectories " << endl; | 278 cout << trajectoryIds.size() << " trajectories " << endl; |
| 279 BOOST_FOREACH(int trajectoryId, trajectoryIds) { | 279 BOOST_FOREACH(int trajectoryId, trajectoryIds) { |
| 280 //cout << trajectoryId << " " << endl; | 280 //cout << trajectoryId << " " << endl; |
| 281 // boost::shared_ptr<Trajectory<cv::Point2f> > trajectory; | 281 // boost::shared_ptr<Trajectory<cv::Point2f> > trajectory; |
| 282 // success = trajectoryDB->read(trajectory, trajectoryId, "positions"); // velocities | 282 // success = trajectoryDB->read(trajectory, trajectoryId, "positions"); // velocities |
| 283 FeatureTrajectoryPtr ft = FeatureTrajectoryPtr(new FeatureTrajectory(trajectoryId, *trajectoryDB, "positions", "velocities")); | 283 FeatureTrajectoryPtr ft = FeatureTrajectoryPtr(new FeatureTrajectory(trajectoryId, *trajectoryDB, "positions", "velocities")); |
| 284 //stringstream ss;ss << *ft; cout << ss.str() << endl; | 284 stringstream ss;ss << *ft; cout << ss.str() << endl; |
| 285 cout << ft->getFirstInstant() << " " << ft->getLastInstant() << endl; | |
| 285 } | 286 } |
| 286 | 287 |
| 287 // should the trajectory be loaded one by one? yes | 288 // should the trajectory be loaded one by one? yes |
| 288 | 289 |
| 289 } | 290 } |
