Mercurial Hosting > traffic-intelligence
comparison c/feature-based-tracking.cpp @ 1020:9fb82fe0156f
added quiet tracking mode
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 05 Jun 2018 14:33:31 -0400 |
parents | 6c5ce3ec497e |
children | 05ccd8ef150c |
comparison
equal
deleted
inserted
replaced
1019:5d2f6afae35b | 1020:9fb82fe0156f |
---|---|
158 for (unsigned int frameNum = params.frame1; (frameNum < lastFrameNum) && !::interruptionKey(key); frameNum++) { | 158 for (unsigned int frameNum = params.frame1; (frameNum < lastFrameNum) && !::interruptionKey(key); frameNum++) { |
159 capture >> frame; | 159 capture >> frame; |
160 if (frame.empty()) { | 160 if (frame.empty()) { |
161 cout << "Empty frame " << frameNum << ", breaking (" << frame.empty() << " [" << frame.size().width << "x" << frame.size().height << "])" << endl; | 161 cout << "Empty frame " << frameNum << ", breaking (" << frame.empty() << " [" << frame.size().width << "x" << frame.size().height << "])" << endl; |
162 break; | 162 break; |
163 } else if (frameNum%50 ==0) | 163 } else if (!params.quiet && (frameNum%50 ==0)) |
164 cout << "frame " << frameNum << endl; | 164 cout << "frame " << frameNum << endl; |
165 | 165 |
166 cvtColor(frame, currentFrameBW, CV_RGB2GRAY); | 166 cvtColor(frame, currentFrameBW, CV_RGB2GRAY); |
167 | 167 |
168 if (!prevPts.empty()) { | 168 if (!prevPts.empty()) { |
294 if (params.nFrames>0) | 294 if (params.nFrames>0) |
295 lastFrameNum = MIN(lastFrameNum,params.frame1+params.nFrames); | 295 lastFrameNum = MIN(lastFrameNum,params.frame1+params.nFrames); |
296 for (frameNum = firstFrameNum; frameNum<lastFrameNum; frameNum ++) { | 296 for (frameNum = firstFrameNum; frameNum<lastFrameNum; frameNum ++) { |
297 vector<int> trajectoryIds; | 297 vector<int> trajectoryIds; |
298 success = trajectoryDB->trajectoryIdEndingAt(trajectoryIds, frameNum); | 298 success = trajectoryDB->trajectoryIdEndingAt(trajectoryIds, frameNum); |
299 if (frameNum%100 ==0) | 299 if (!params.quiet && (frameNum%100 ==0)) |
300 cout << "frame " << frameNum << endl; | 300 cout << "frame " << frameNum << endl; |
301 #if DEBUG | 301 #if DEBUG |
302 cout << trajectoryIds.size() << " trajectories " << endl; | 302 cout << trajectoryIds.size() << " trajectories " << endl; |
303 #endif | 303 #endif |
304 BOOST_FOREACH(int trajectoryId, trajectoryIds) { | 304 BOOST_FOREACH(int trajectoryId, trajectoryIds) { |
319 trajectoryDB->writeObject(savedObjectId, featureNumbers, 0 /* unknown type */, 1, string("objects"), string("objects_features")); | 319 trajectoryDB->writeObject(savedObjectId, featureNumbers, 0 /* unknown type */, 1, string("objects"), string("objects_features")); |
320 savedObjectId++; | 320 savedObjectId++; |
321 } | 321 } |
322 } | 322 } |
323 | 323 |
324 if (frameNum%100 ==0) | 324 if (!params.quiet && (frameNum%100 ==0)) |
325 cout << featureGraph.informationString() << endl; | 325 cout << featureGraph.informationString() << endl; |
326 } | 326 } |
327 | 327 |
328 // save remaining objects | 328 // save remaining objects |
329 featureGraph.connectedComponents(frameNum+maxTrajectoryLength+1); | 329 featureGraph.connectedComponents(frameNum+maxTrajectoryLength+1); |