# HG changeset patch # User Nicolas Saunier # Date 1580397427 18000 # Node ID b358bed29ab44dd2b5fd1a373032c5366184f73a # Parent 234e2228fd30752db30970fb5a3247f027b448be updates and bugs diff -r 234e2228fd30 -r b358bed29ab4 c/feature-based-tracking.cpp --- a/c/feature-based-tracking.cpp Tue Jun 25 17:23:43 2019 -0400 +++ b/c/feature-based-tracking.cpp Thu Jan 30 10:17:07 2020 -0500 @@ -231,15 +231,15 @@ for (int i=MAX(0, currPts[n].y-params.minFeatureDistanceKLT); i(i,j)=0; goodFeaturesToTrack(currentFrameBW, newPts, params.maxNFeatures, params.featureQuality, params.minFeatureDistanceKLT, featureMask, params.blockSize, params.useHarrisDetector, params.k); - if (params.undistort) + if (params.undistort && newPts.size() > 0) undistortPoints(newPts, undistortedPts, intrinsicCameraMatrix, params.distortionCoefficients); else undistortedPts = newPts; for (unsigned int i=0; i minNPixels: + if yCropMax > yCropMin and xCropMax > xCropMin and (yCropMax - yCropMin) * (xCropMax - xCropMin) > minNPixels: return img[yCropMin : yCropMax, xCropMin : xCropMax] else: return None diff -r 234e2228fd30 -r b358bed29ab4 trafficintelligence/indicators.py --- a/trafficintelligence/indicators.py Tue Jun 25 17:23:43 2019 -0400 +++ b/trafficintelligence/indicators.py Thu Jan 30 10:17:07 2020 -0500 @@ -74,8 +74,15 @@ def getName(self): return self.name - def getValues(self): - return [self.__getitem__(t) for t in self.timeInterval] + def getValues(self, withNone = True): + result = [self.__getitem__(t) for t in self.timeInterval] + if withNone: + return result + else: + return [x for x in result if x is not None] + + def getInstants(self): + return list(self.values.keys()) def plot(self, options = '', xfactor = 1., yfactor = 1., timeShift = 0, **kwargs): if self.getTimeInterval().length() == 1: diff -r 234e2228fd30 -r b358bed29ab4 trafficintelligence/moving.py --- a/trafficintelligence/moving.py Tue Jun 25 17:23:43 2019 -0400 +++ b/trafficintelligence/moving.py Thu Jan 30 10:17:07 2020 -0500 @@ -738,6 +738,11 @@ else: return False + def append(self,other): + '''adds positions of other to the trajectory (in-place modification)''' + for p in other: + self.addPosition(p) + def setPositionXY(self, i, x, y): if i < self.__len__(): self.positions[0][i] = x @@ -1076,11 +1081,6 @@ lanes = [lane]*nPoints return CurvilinearTrajectory(S, Y, lanes) - def append(self,other): - '''adds positions of other to the curvilinear trajectory (in-place modification)''' - for p in other: - self.addPosition(p) - @staticmethod def fromTrajectoryProjection(t, alignments, halfWidth = 3): ''' Add, for every object position, the class 'moving.CurvilinearTrajectory()' @@ -1216,7 +1216,8 @@ 'motorcycle', 'bicycle', 'bus', - 'truck'] + 'truck', + 'automated'] userType2Num = utils.inverseEnumeration(userTypeNames) @@ -1425,6 +1426,12 @@ else: return None + def getCurvilinearVelocities(self): + if hasattr(self, 'curvilinearVelocities'): + return self.curvilinearVelocities + else: + return None + def plotCurvilinearPositions(self, lane = None, options = '', withOrigin = False, **kwargs): if hasattr(self, 'curvilinearPositions'): if lane is None: