Mercurial > hg > nsaunier > traffic-intelligence
comparison c/feature-based-tracking.cpp @ 202:b0b964ba9489
added early saving of objects
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Mon, 05 Mar 2012 02:55:19 -0500 |
| parents | 09c7881073f3 |
| children | 48f83ff769fd |
comparison
equal
deleted
inserted
replaced
| 201:f7ddfc4aeb1e | 202:b0b964ba9489 |
|---|---|
| 253 cout << "group" << endl; | 253 cout << "group" << endl; |
| 254 | 254 |
| 255 boost::shared_ptr<TrajectoryDBAccessList<Point2f> > trajectoryDB = boost::shared_ptr<TrajectoryDBAccessList<Point2f> >(new TrajectoryDBAccessList<Point2f>()); | 255 boost::shared_ptr<TrajectoryDBAccessList<Point2f> > trajectoryDB = boost::shared_ptr<TrajectoryDBAccessList<Point2f> >(new TrajectoryDBAccessList<Point2f>()); |
| 256 //TODO write generic methods for blob and list versions TrajectoryDBAccess<Point2f>* trajectoryDB = new TrajectoryDBAccessBlob<Point2f>(); | 256 //TODO write generic methods for blob and list versions TrajectoryDBAccess<Point2f>* trajectoryDB = new TrajectoryDBAccessBlob<Point2f>(); |
| 257 bool success = trajectoryDB->connect(params.databaseFilename.c_str()); | 257 bool success = trajectoryDB->connect(params.databaseFilename.c_str()); |
| 258 trajectoryDB->createObjectTable("objects", "objects_features"); | |
| 259 unsigned int savedObjectId=0; | |
| 260 | |
| 258 // vector<boost::shared_ptr<Trajectory<Point2f> > > trajectories; | 261 // vector<boost::shared_ptr<Trajectory<Point2f> > > trajectories; |
| 259 // cout << trajectories.size() << endl; | 262 // cout << trajectories.size() << endl; |
| 260 // std::clock_t c_start = std::clock(); | 263 // std::clock_t c_start = std::clock(); |
| 261 // success = trajectoryDB->read(trajectories, "positions"); // TODO load velocities as well in a FeatureTrajectory object // attention, velocities lack the first instant | 264 // success = trajectoryDB->read(trajectories, "positions"); // TODO load velocities as well in a FeatureTrajectory object // attention, velocities lack the first instant |
| 262 // std::clock_t c_end = std::clock(); | 265 // std::clock_t c_end = std::clock(); |
| 298 // check for connected components that are old enough (no chance to match with trajectories to be added later | 301 // check for connected components that are old enough (no chance to match with trajectories to be added later |
| 299 // we could check only when some features are getting old enough? | 302 // we could check only when some features are getting old enough? |
| 300 if (frameNum%10 == 0) { | 303 if (frameNum%10 == 0) { |
| 301 featureGraph.connectedComponents(frameNum-maxTrajectoryLength+params.minFeatureTime); | 304 featureGraph.connectedComponents(frameNum-maxTrajectoryLength+params.minFeatureTime); |
| 302 vector<vector<unsigned int> > featureGroups = featureGraph.getFeatureGroups(); | 305 vector<vector<unsigned int> > featureGroups = featureGraph.getFeatureGroups(); |
| 306 for (unsigned int i=0; i<featureGroups.size(); ++i) { | |
| 307 trajectoryDB->writeObject(savedObjectId, featureGroups[i], -1, 1, string("objects"), string("objects_features")); | |
| 308 savedObjectId++; | |
| 309 } | |
| 303 } | 310 } |
| 304 | 311 |
| 305 cout << featureGraph.informationString() << endl; | 312 cout << featureGraph.informationString() << endl; |
| 306 } | 313 } |
| 307 | 314 |
