diff c/Motion.cpp @ 225:d4d3b1e8a9f1

added code to process only needed frames based on saved features
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 26 Jun 2012 03:37:19 -0400
parents bc93e87a2108
children 249d65ff6c35
line wrap: on
line diff
--- a/c/Motion.cpp	Tue Jun 26 03:36:55 2012 -0400
+++ b/c/Motion.cpp	Tue Jun 26 03:37:19 2012 -0400
@@ -101,8 +101,8 @@
   if (frameNum > lastInstant)
     lastInstant = frameNum;
   computeMotionData(frameNum);
-  assert(positions.size() == displacementDistances.size()+1);
-  assert(positions.size() == velocities.size()+1);
+  assert(positions->size() == displacementDistances.size()+1);
+  assert(positions->size() == velocities->size()+1);
 }
 
 void FeatureTrajectory::shorten(void) { 
@@ -158,8 +158,8 @@
        vi!=vertices(graph).second; ++vi) { // vi pointer to vertex_descriptor
     FeatureTrajectoryPtr ft2 = graph[*vi].feature;
     if (newVertex != *vi) {
-      int lastInstant = static_cast<int>(min(ft->getLastInstant(), ft2->getLastInstant()));
-      int firstInstant = static_cast<int>(max(ft->getFirstInstant(), ft2->getFirstInstant()));
+      int lastInstant = static_cast<int>(MIN(ft->getLastInstant(), ft2->getLastInstant()));
+      int firstInstant = static_cast<int>(MAX(ft->getFirstInstant(), ft2->getFirstInstant()));
       if (lastInstant-firstInstant > static_cast<int>(minFeatureTime)) { // equivalent to lastInstant-firstInstant+1 >= minFeatureTime
 	if (ft->minMaxSimilarity(*ft2, firstInstant, lastInstant, connectionDistance, segmentationDistance)) {
 	  UndirectedGraph::edge_descriptor e;
@@ -211,8 +211,8 @@
     unsigned int lastInstant = graph[objectHypotheses[i][0]].feature->getLastInstant();
       for (unsigned int j=1; j<objectHypotheses[i].size(); ++j) {
 	totalFeatureTime += graph[objectHypotheses[i][j]].feature->length();
-	firstInstant = min(firstInstant, graph[objectHypotheses[i][j]].feature->getFirstInstant());
-	lastInstant = max(lastInstant, graph[objectHypotheses[i][j]].feature->getLastInstant());	
+	firstInstant = MIN(firstInstant, graph[objectHypotheses[i][j]].feature->getFirstInstant());
+	lastInstant = MAX(lastInstant, graph[objectHypotheses[i][j]].feature->getLastInstant());	
       }
     if (static_cast<float>(totalFeatureTime)/static_cast<float>(lastInstant-firstInstant+1) > minNFeaturesPerGroup) {
 #if DEBUG