diff trafficintelligence/moving.py @ 1249:2aa56b101041

added mask functionality for dltrack
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 15 Feb 2024 14:09:52 -0500
parents 371c718e57d7
children 77fbd0e2ba7d
line wrap: on
line diff
--- a/trafficintelligence/moving.py	Thu Feb 15 14:09:23 2024 -0500
+++ b/trafficintelligence/moving.py	Thu Feb 15 14:09:52 2024 -0500
@@ -2,7 +2,7 @@
 '''Libraries for moving objects, trajectories...'''
 
 import copy
-from math import sqrt, atan2, cos, sin
+from math import sqrt, atan2, cos, sin, inf
 
 from numpy import median, mean, array, arange, zeros, ones, hypot, NaN, std, floor, ceil, float32, argwhere, minimum,  issubdtype, integer as npinteger, percentile
 from matplotlib.pyplot import plot, text, arrow
@@ -295,7 +295,7 @@
         return (self.x, self.y)
 
     def asint(self):
-        return Point(int(self.x), int(self.y))
+        return Point(int(round(self.x)), int(round(self.y)))
 
     if shapelyAvailable:
         def asShapely(self):
@@ -2054,7 +2054,7 @@
         self.setUserType(utils.argmaxDict(userTypeProbabilities))
         return userTypeProbabilities
 
-    def initClassifyUserTypeHoGSVM(self, aggregationFunc, pedBikeCarSVM, bikeCarSVM = None, pedBikeSpeedThreshold = float('Inf'), bikeCarSpeedThreshold = float('Inf'), nInstantsIgnoredAtEnds = 0, homography = None, intrinsicCameraMatrix = None, distortionCoefficients = None):
+    def initClassifyUserTypeHoGSVM(self, aggregationFunc, pedBikeCarSVM, bikeCarSVM = None, pedBikeSpeedThreshold = inf, bikeCarSpeedThreshold = float('Inf'), nInstantsIgnoredAtEnds = 0, homography = None, intrinsicCameraMatrix = None, distortionCoefficients = None):
         '''Initializes the data structures for classification
 
         TODO? compute speed for longest feature?'''