Mercurial > hg > nsaunier > traffic-intelligence
comparison c/feature-based-tracking.cpp @ 191:0e60a306d324
added basic code to identify features and save them (crash)
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Thu, 08 Dec 2011 18:32:35 -0500 |
| parents | 1116f0a1ff31 |
| children | a728fce85881 |
comparison
equal
deleted
inserted
replaced
| 190:36968a63efe1 | 191:0e60a306d324 |
|---|---|
| 263 | 263 |
| 264 trajectoryDB->createViewInstants(); | 264 trajectoryDB->createViewInstants(); |
| 265 int maxTrajectoryLength; | 265 int maxTrajectoryLength; |
| 266 trajectoryDB->maxTrajectoryLength(maxTrajectoryLength); | 266 trajectoryDB->maxTrajectoryLength(maxTrajectoryLength); |
| 267 cout << "max trajectory length " << maxTrajectoryLength << endl; | 267 cout << "max trajectory length " << maxTrajectoryLength << endl; |
| 268 | 268 maxTrajectoryLength = 20; // for tests |
| 269 FeatureGraph featureGraph(params.mmConnectionDistance, params.mmSegmentationDistance, params.minFeatureTime); | 269 |
| 270 FeatureGraph featureGraph(params.mmConnectionDistance, params.mmSegmentationDistance, params.minFeatureTime, params.minNFeaturesPerGroup); | |
| 270 | 271 |
| 271 // main loop | 272 // main loop |
| 272 // TODO version that can be interrupted? | 273 // TODO version that can be interrupted? |
| 273 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++) { |
| 274 vector<int> trajectoryIds; | 275 vector<int> trajectoryIds; |
| 284 // cout << ft->getFirstInstant() << " " << ft->getLastInstant() << endl; | 285 // cout << ft->getFirstInstant() << " " << ft->getLastInstant() << endl; |
| 285 featureGraph.addFeature(ft); | 286 featureGraph.addFeature(ft); |
| 286 } | 287 } |
| 287 | 288 |
| 288 // check for connected components that are old enough (no chance to match with trajectories to be added later | 289 // check for connected components that are old enough (no chance to match with trajectories to be added later |
| 290 // we could check only when some features are getting old enough? | |
| 289 if (frameNum%10 == 0) { | 291 if (frameNum%10 == 0) { |
| 290 featureGraph.connectedComponents(frameNum-maxTrajectoryLength+params.minFeatureTime); | 292 vector<vector<FeatureGraph::vertex_descriptor> > objects = featureGraph.connectedComponents(frameNum-maxTrajectoryLength+params.minFeatureTime); |
| 293 cout << objects.size() << " objects" << endl; | |
| 294 | |
| 295 if (!objects.empty()) { | |
| 296 vector<vector<unsigned int> > featureGroups = featureGraph.getFeatureGroups(objects); | |
| 297 } | |
| 291 } | 298 } |
| 292 | 299 |
| 293 cout << featureGraph.informationString() << endl; | 300 cout << featureGraph.informationString() << endl; |
| 294 } | 301 } |
| 295 | 302 |
