diff python/moving.py @ 523:ce4eaabacc26

modified internal implementation of user type for classifyUserTypeArea
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 18 Jun 2014 23:40:47 -0400
parents ce40a89bd6ae
children 1dced8932b08
line wrap: on
line diff
--- a/python/moving.py	Wed Jun 18 23:36:56 2014 -0400
+++ b/python/moving.py	Wed Jun 18 23:40:47 2014 -0400
@@ -918,13 +918,11 @@
                 self.projectedPositions = obj.positions.project(homography)
             else:
                 self.projectedPositions = obj.positions
-        possibleUserTypes = {}
-        for userTypename in userTypenames:
-            possibleUserTypes[userTypename] = 0
+        possibleUserTypes = {userType: 0 for userType in range(len(userTypenames))}
         for p in self.projectedPositions:
             for userTypename in areas:
                 if areas[userTypename][p.x, p.y] != 0:
-                    possibleUserTypes[userTypename] += 1
+                    possibleUserTypes[userType2Enum[userTypename]] += 1
         # what to do: threshold for most common type? self.setUserType()
         return possibleUserTypes