diff python/objectsmoothing.py @ 998:933670761a57

updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sun, 27 May 2018 23:22:48 -0400
parents 15e244d2a1b5
children
line wrap: on
line diff
--- a/python/objectsmoothing.py	Fri May 25 18:15:18 2018 -0400
+++ b/python/objectsmoothing.py	Sun May 27 23:22:48 2018 -0400
@@ -50,7 +50,7 @@
     tmp={}
     delta={}
     for i in featureList:
-        for t in xrange(i[1],i[2]+1):
+        for t in range(i[1],i[2]+1):
             tmp[t]=[i[0],i[3]]
     newTraj = moving.Trajectory()
     
@@ -152,7 +152,7 @@
         #solve a smoothing problem in case of big drop in computing bearing (0,360)    
         for t,i in enumerate(sorted(bearing.keys())):
             if i!= max(bearing.keys()) and abs(bearingInput[t] - bearingInput[t+1])>=340:
-                for x in xrange(max(i-halfWidth,min(bearing.keys())),min(i+halfWidth,max(bearing.keys()))+1):
+                for x in range(max(i-halfWidth,min(bearing.keys())),min(i+halfWidth,max(bearing.keys()))+1):
                     bearing[x]=bearingInput[t-i+x]
 
     translated = moving.Trajectory()
@@ -166,7 +166,7 @@
     if smoothing:
         d1= translated[halfWidth]- feature.positions[halfWidth]
         d2= translated[-halfWidth-1]- feature.positions[-halfWidth-1]
-        for i in xrange(halfWidth):
+        for i in range(halfWidth):
             p1= feature.getPositionAt(i)+d1
             p2= feature.getPositionAt(-i-1)+d2
             translated.setPosition(i,p1)