diff python/moving.py @ 982:51d8406b2489

corrected bug when not using a homography and using a mask for CLEAR MOT metrics
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 27 Feb 2018 16:45:46 -0500
parents 184f1dd307f9
children f026ce2af637
line wrap: on
line diff
--- a/python/moving.py	Tue Feb 27 15:24:57 2018 -0500
+++ b/python/moving.py	Tue Feb 27 16:45:46 2018 -0500
@@ -1196,7 +1196,7 @@
         if not intersection.empty():
             trajectoryInterval = TimeInterval(intersection.first-self.getFirstInstant(), intersection.last-self.getFirstInstant())
             obj = MovingObject(self.num, intersection, self.positions.getTrajectoryInInterval(trajectoryInterval), self.geometry, self.userType)
-            if self.velocities:
+            if self.velocities is not None:
                 obj.velocities = self.velocities.getTrajectoryInInterval(trajectoryInterval)
             return obj
         else:
@@ -1212,7 +1212,7 @@
             self.projectedPositions = self.positions
         def inMask(positions, i, mask):
             p = positions[i]
-            return mask[p.y, p.x] != 0.
+            return mask[int(p.y), int(p.x)] != 0.
 
         #subTimeIntervals self.getFirstInstant()+i
         filteredIndices = [inMask(self.projectedPositions, i, mask) for i in range(int(self.length()))]