changeset 626:35155ac2a294

corrected bugs, in particular to MovingObject.play
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sat, 14 Feb 2015 19:18:14 -0500
parents 9202628a4130
children 82e9f78a4714
files python/moving.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/python/moving.py	Fri Feb 13 09:10:29 2015 -0500
+++ b/python/moving.py	Sat Feb 14 19:18:14 2015 -0500
@@ -793,9 +793,10 @@
         for p in self:
             if p.similarOrientation(refDirection, cosineThreshold):
                 count += 1
-            if count > lengthThreshold:
-                return True
-        return False
+        if count > lengthThreshold:
+            return True
+        else:
+            return False
 
     def wiggliness(self):
         return self.getCumulativeDistance(self.length()-1)/float(Point.distanceNorm2(self.__getitem__(0),self.__getitem__(self.length()-1)))
@@ -1070,8 +1071,8 @@
     def plotOnWorldImage(self, nPixelsPerUnitDistance, options = '', withOrigin = False, timeStep = 1, **kwargs):
         self.positions.plotOnWorldImage(nPixelsPerUnitDistance, options, withOrigin, timeStep, **kwargs)
 
-    def play(self, videoFilename, homography = None):
-        cvutils.displayTrajectories(videoFilename, [self], homography, self.getFirstInstant(), self.getLastInstant())
+    def play(self, videoFilename, homography = None, undistort = False, intrinsicCameraMatrix = None, distortionCoefficients = None, undistortedImageMultiplication = 1.):
+        cvutils.displayTrajectories(videoFilename, [self], homography = homography, firstFrameNum = self.getFirstInstant(), lastFrameNumArg = self.getLastInstant(), undistort = undistort, intrinsicCameraMatrix = intrinsicCameraMatrix, distortionCoefficients = distortionCoefficients, undistortedImageMultiplication = undistortedImageMultiplication)
 
     def speedDiagnostics(self, framerate = 1., display = False):
         from numpy import std
@@ -1243,7 +1244,7 @@
         return 1
         else:
         return x'''
-        if not hasattr(self, aggregatedSpeed):
+        if not hasattr(self, 'aggregatedSpeed'):
             self.aggregatedSpeed = aggregationFunc(self.getSpeeds())
         userTypeProbabilities = {}
         for userTypename in speedProbabilities: