Mercurial Hosting > traffic-intelligence
comparison c/feature-based-tracking.cpp @ 188:1435965d8181
work on connected components
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 01 Dec 2011 19:18:32 -0500 |
parents | 6c48283a78ca |
children | 1116f0a1ff31 |
comparison
equal
deleted
inserted
replaced
187:aa1061fb9695 | 188:1435965d8181 |
---|---|
244 cout << "group" << endl; | 244 cout << "group" << endl; |
245 | 245 |
246 boost::shared_ptr<TrajectoryDBAccessList<Point2f> > trajectoryDB = boost::shared_ptr<TrajectoryDBAccessList<Point2f> >(new TrajectoryDBAccessList<Point2f>()); | 246 boost::shared_ptr<TrajectoryDBAccessList<Point2f> > trajectoryDB = boost::shared_ptr<TrajectoryDBAccessList<Point2f> >(new TrajectoryDBAccessList<Point2f>()); |
247 //TODO write generic methods for blob and list versions TrajectoryDBAccess<Point2f>* trajectoryDB = new TrajectoryDBAccessBlob<Point2f>(); | 247 //TODO write generic methods for blob and list versions TrajectoryDBAccess<Point2f>* trajectoryDB = new TrajectoryDBAccessBlob<Point2f>(); |
248 bool success = trajectoryDB->connect(params.databaseFilename.c_str()); | 248 bool success = trajectoryDB->connect(params.databaseFilename.c_str()); |
249 vector<boost::shared_ptr<Trajectory<Point2f> > > trajectories; | 249 // vector<boost::shared_ptr<Trajectory<Point2f> > > trajectories; |
250 cout << trajectories.size() << endl; | 250 // cout << trajectories.size() << endl; |
251 // std::clock_t c_start = std::clock(); | 251 // std::clock_t c_start = std::clock(); |
252 // success = trajectoryDB->read(trajectories, "positions"); // TODO load velocities as well in a FeatureTrajectory object // attention, velocities lack the first instant | 252 // success = trajectoryDB->read(trajectories, "positions"); // TODO load velocities as well in a FeatureTrajectory object // attention, velocities lack the first instant |
253 // std::clock_t c_end = std::clock(); | 253 // std::clock_t c_end = std::clock(); |
254 // cout << "Loaded " << trajectories.size() << " trajectories in " << 1000.0 * (c_end-c_start) / CLOCKS_PER_SEC << " CPU seconds" << endl; | 254 // cout << "Loaded " << trajectories.size() << " trajectories in " << 1000.0 * (c_end-c_start) / CLOCKS_PER_SEC << " CPU seconds" << endl; |
255 | 255 |
260 // } | 260 // } |
261 // c_end = std::clock(); | 261 // c_end = std::clock(); |
262 // cout << "Loaded " << trajectories.size() << " trajectories one by one in " << 1000.0 * (c_end-c_start) / CLOCKS_PER_SEC << " CPU seconds" << endl; | 262 // cout << "Loaded " << trajectories.size() << " trajectories one by one in " << 1000.0 * (c_end-c_start) / CLOCKS_PER_SEC << " CPU seconds" << endl; |
263 | 263 |
264 trajectoryDB->createViewInstants(); | 264 trajectoryDB->createViewInstants(); |
265 //trajectoryDB->createViewInstants("last"); | |
266 int maxTrajectoryLength; | 265 int maxTrajectoryLength; |
267 trajectoryDB->maxTrajectoryLength(maxTrajectoryLength); | 266 trajectoryDB->maxTrajectoryLength(maxTrajectoryLength); |
268 cout << "max trajectory length " << maxTrajectoryLength << endl; | 267 cout << "max trajectory length " << maxTrajectoryLength << endl; |
269 | 268 |
270 FeatureGraph featureGraph(params.mmConnectionDistance, params.mmSegmentationDistance, params.minFeatureTime); | 269 FeatureGraph featureGraph(params.mmConnectionDistance, params.mmSegmentationDistance, params.minFeatureTime); |
284 // stringstream ss;ss << *ft; cout << ss.str() << endl; | 283 // stringstream ss;ss << *ft; cout << ss.str() << endl; |
285 // cout << ft->getFirstInstant() << " " << ft->getLastInstant() << endl; | 284 // cout << ft->getFirstInstant() << " " << ft->getLastInstant() << endl; |
286 featureGraph.addFeature(ft); | 285 featureGraph.addFeature(ft); |
287 } | 286 } |
288 | 287 |
289 // should the trajectory be loaded one by one? yes | 288 // check for connected components that are old enough (no chance to match with trajectories to be added later |
289 if (frameNum%10 == 0) { | |
290 | |
291 } | |
290 | 292 |
291 cout << featureGraph.informationString() << endl; | 293 cout << featureGraph.informationString() << endl; |
292 } | 294 } |
293 | 295 |
294 trajectoryDB->endTransaction(); | 296 trajectoryDB->endTransaction(); |