Mercurial > hg > nsaunier > traffic-intelligence
comparison c/feature-based-tracking.cpp @ 175:a234a5e818f3
using single view for frame_numbers and getting max trajectory length
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 26 Oct 2011 19:09:50 -0400 |
| parents | ec9734015d53 |
| children | 9323427aa0a3 |
comparison
equal
deleted
inserted
replaced
| 174:ec9734015d53 | 175:a234a5e818f3 |
|---|---|
| 261 // success = trajectoryDB->read(trajectory, i, "positions"); | 261 // success = trajectoryDB->read(trajectory, i, "positions"); |
| 262 // } | 262 // } |
| 263 // c_end = std::clock(); | 263 // c_end = std::clock(); |
| 264 // cout << "Loaded " << trajectories.size() << " trajectories one by one in " << 1000.0 * (c_end-c_start) / CLOCKS_PER_SEC << " CPU seconds" << endl; | 264 // cout << "Loaded " << trajectories.size() << " trajectories one by one in " << 1000.0 * (c_end-c_start) / CLOCKS_PER_SEC << " CPU seconds" << endl; |
| 265 | 265 |
| 266 trajectoryDB->createViewInstants("first"); | 266 trajectoryDB->createViewInstants(); |
| 267 trajectoryDB->createViewInstants("last"); | 267 //trajectoryDB->createViewInstants("last"); |
| 268 int maxTrajectoryLength; | |
| 269 trajectoryDB->maxTrajectoryLength(maxTrajectoryLength); | |
| 270 cout << "max trajectory length " << maxTrajectoryLength << endl; | |
| 268 | 271 |
| 269 // main loop | 272 // main loop |
| 270 // TODO version que l'on peut interrompre ? | 273 // TODO version que l'on peut interrompre ? |
| 271 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++) { |
| 272 vector<int> trajectoryIds; | 275 vector<int> trajectoryIds; |
| 275 cout << trajectoryIds.size() << " trajectories " << endl; | 278 cout << trajectoryIds.size() << " trajectories " << endl; |
| 276 BOOST_FOREACH(int trajectoryId, trajectoryIds) { | 279 BOOST_FOREACH(int trajectoryId, trajectoryIds) { |
| 277 //cout << trajectoryId << " " << endl; | 280 //cout << trajectoryId << " " << endl; |
| 278 boost::shared_ptr<Trajectory<cv::Point2f> > trajectory; | 281 boost::shared_ptr<Trajectory<cv::Point2f> > trajectory; |
| 279 success = trajectoryDB->read(trajectory, trajectoryId, "positions"); // velocities | 282 success = trajectoryDB->read(trajectory, trajectoryId, "positions"); // velocities |
| 280 stringstream ss;ss << *trajectory; cout << ss.str() << endl; | 283 //stringstream ss;ss << *trajectory; cout << ss.str() << endl; |
| 281 } | 284 } |
| 282 | 285 |
| 283 // should the trajectory be loaded one by one? yes | 286 // should the trajectory be loaded one by one? yes |
| 284 | 287 |
| 285 } | 288 } |
