diff c/feature-based-tracking.cpp @ 230:bc4ea09b1743

compatibility modifications for visual studio compilation
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 29 Jun 2012 16:15:13 -0400
parents 48f83ff769fd
children 249d65ff6c35
line wrap: on
line diff
--- a/c/feature-based-tracking.cpp	Wed May 16 02:23:49 2012 -0400
+++ b/c/feature-based-tracking.cpp	Fri Jun 29 16:15:13 2012 -0400
@@ -76,7 +76,7 @@
   Size window = Size(params.windowSize, params.windowSize);
 
   // BruteForceMatcher<Hamming> descMatcher;
-  // vector<DMatch> matches;
+  // std::vector<DMatch> matches;
   Size videoSize;
 
   // if( argc == 1 || (argc == 2 && strlen(argv[1]) == 1 && isdigit(argv[1][0]))) // if no parameter or number parameter
@@ -130,14 +130,14 @@
   trajectoryDB->createTable("velocities");
   trajectoryDB->beginTransaction();
 
-  vector<KeyPoint> prevKpts, currKpts;
-  vector<Point2f> prevPts, currPts, newPts;
-  vector<uchar> status;
-  vector<float> errors;
+  std::vector<KeyPoint> prevKpts, currKpts;
+  std::vector<Point2f> prevPts, currPts, newPts;
+  std::vector<uchar> status;
+  std::vector<float> errors;
   Mat prevDesc, currDesc;
 
-  vector<FeatureTrajectoryPtr> lostFeatures;
-  vector<FeaturePointMatch> featurePointMatches;
+  std::vector<FeatureTrajectoryPtr> lostFeatures;
+  std::vector<FeaturePointMatch> featurePointMatches;
 
   HOGDescriptor hog;
   hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());
@@ -158,7 +158,6 @@
       }
       
       cvtColor(frame, currentFrameBW, CV_RGB2GRAY);
-
       // "normal" feature detectors: detect features here
       // detector.detect(currentFrameBW, currKpts); // see video_homography c++ sample
       
@@ -168,8 +167,8 @@
 	calcOpticalFlowPyrLK(previousFrameBW, currentFrameBW, prevPts, currPts, status, errors, window, params.pyramidLevel, TermCriteria(3 /*static_cast<int>(TermCriteria::COUNT)+static_cast<int>(TermCriteria::EPS)*/, params.maxNumberTrackingIterations, params.minTrackingError), 0.5 /* unused */, 0); // OPTFLOW_USE_INITIAL_FLOW
 	/// \todo try calcOpticalFlowFarneback
 
-	vector<Point2f> trackedPts;
-	vector<FeaturePointMatch>::iterator iter = featurePointMatches.begin();
+	std::vector<Point2f> trackedPts;
+	std::vector<FeaturePointMatch>::iterator iter = featurePointMatches.begin();
 	while (iter != featurePointMatches.end()) {
 	  bool deleteFeature = false;
 	  
@@ -284,7 +283,7 @@
   // main loop
   // TODO version that can be interrupted?
   for (int frameNum = params.frame1; ((frameNum-params.frame1 < params.nFrames) || (params.nFrames < 0)); frameNum++) {
-    vector<int> trajectoryIds;
+    std::vector<int> trajectoryIds;
     success  = trajectoryDB->trajectoryIdEndingAt(trajectoryIds, frameNum); // ending
     cout << "frame " << frameNum << " " << success << endl;
     cout << trajectoryIds.size() << " trajectories " << endl;
@@ -302,7 +301,7 @@
     // we could check only when some features are getting old enough?
     if (frameNum%10 == 0) {
       featureGraph.connectedComponents(frameNum-maxTrajectoryLength+params.minFeatureTime);
-      vector<vector<unsigned int> > featureGroups = featureGraph.getFeatureGroups();
+      std::vector<vector<unsigned int> > featureGroups = featureGraph.getFeatureGroups();
       for (unsigned int i=0; i<featureGroups.size(); ++i) {
 	trajectoryDB->writeObject(savedObjectId, featureGroups[i], -1, 1, string("objects"), string("objects_features"));
 	savedObjectId++;
@@ -319,7 +318,7 @@
 int main(int argc, char *argv[]) {
   KLTFeatureTrackingParameters params(argc, argv);
   cout << params.parameterDescription << endl;
-
+  params.trackFeatures = true;
   if (params.trackFeatures)
     trackFeatures(params);
   else if (params.groupFeatures)