changeset 622:dc8490726d06

corrected issues created with homography projection in Trajectory
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Mon, 22 Dec 2014 16:29:34 -0500
parents 582508610572
children ce7133cbcdf3
files python/moving.py
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/python/moving.py	Wed Dec 10 15:29:57 2014 -0500
+++ b/python/moving.py	Mon Dec 22 16:29:34 2014 -0500
@@ -676,7 +676,7 @@
             plot([positions[0][0]], [positions[1][0]], 'ro', **kwargs)
 
     def project(self, homography):
-        return Trajectory(cvutils.projectTrajectory(homography, self.positions))
+        return Trajectory(cvutils.projectTrajectory(homography, self.positions).tolist())
 
     def plot(self, options = '', withOrigin = False, timeStep = 1, **kwargs):
         Trajectory._plot(self.positions, options, withOrigin, None, timeStep, **kwargs)
@@ -817,9 +817,10 @@
         return indices
 
     def getTrajectoryInInterval(self, inter):
+        'Returns all position between index inter.first and index.last (included)'
         if inter.first >=0 and inter.last<= self.length():
-            return Trajectory([self.positions[0][inter.first:inter.last],
-                               self.positions[1][inter.first:inter.last]])
+            return Trajectory([self.positions[0][inter.first:inter.last+1],
+                               self.positions[1][inter.first:inter.last+1]])
         else:
             return None
     
@@ -946,6 +947,11 @@
         positions, velocities = Trajectory.generate(p, v, int(timeInterval.length())) 
         return MovingObject(timeInterval = timeInterval, positions = positions, velocities = velocities)
 
+    @staticmethod
+    def concatenate(obj1, obj2):
+        ''' '''
+        pass
+
     def getObjectInTimeInterval(self, inter):
         '''Returns a new object extracted from self,
         restricted to time interval inter'''