comparison trafficintelligence/moving.py @ 1205:3905b393ade0

kitti loading code seems to be working
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 22 Mar 2023 23:29:09 -0400
parents 7b3384a8e409
children 36f0d18e1fad
comparison
equal deleted inserted replaced
1204:a12d126346ff 1205:3905b393ade0
355 @staticmethod 355 @staticmethod
356 def distanceNorm2(p1, p2): 356 def distanceNorm2(p1, p2):
357 return (p1-p2).norm2() 357 return (p1-p2).norm2()
358 358
359 @staticmethod 359 @staticmethod
360 def plotAll(points, options = '', closePolygon = False, **kwargs): 360 def plotAll(points, closePolygon = False, options = '', **kwargs):
361 xCoords = [p.x for p in points] 361 xCoords = [p.x for p in points]
362 yCoords = [p.y for p in points] 362 yCoords = [p.y for p in points]
363 if closePolygon: 363 if closePolygon:
364 xCoords.append[0] 364 xCoords.append(xCoords[0])
365 yCoords.append[0] 365 yCoords.append(yCoords[0])
366 plot(xCoords, yCoords, options, **kwargs) 366 plot(xCoords, yCoords, options, **kwargs)
367 367
368 def similarOrientation(self, refDirection, cosineThreshold): 368 def similarOrientation(self, refDirection, cosineThreshold):
369 'Indicates whether the cosine of the vector and refDirection is smaller than cosineThreshold' 369 'Indicates whether the cosine of the vector and refDirection is smaller than cosineThreshold'
370 return Point.cosine(self, refDirection) >= cosineThreshold 370 return Point.cosine(self, refDirection) >= cosineThreshold
1657 self.positions.plotOnWorldImage(nPixelsPerUnitDistance, options, withOrigin, timeStep, None, **kwargs) 1657 self.positions.plotOnWorldImage(nPixelsPerUnitDistance, options, withOrigin, timeStep, None, **kwargs)
1658 1658
1659 def plotOutlineAtInstant(self, t, options = '', **kwargs): 1659 def plotOutlineAtInstant(self, t, options = '', **kwargs):
1660 if self.hasFeatures(): 1660 if self.hasFeatures():
1661 points = [f.getPositionAtInstant(t) for f in self.getFeatures()] 1661 points = [f.getPositionAtInstant(t) for f in self.getFeatures()]
1662 Point.plotAll(points, options, True, kwargs) 1662 Point.plotAll(points, True, options, **kwargs)
1663 1663
1664 def play(self, videoFilename, homography = None, undistort = False, intrinsicCameraMatrix = None, distortionCoefficients = None, undistortedImageMultiplication = 1.): 1664 def play(self, videoFilename, homography = None, undistort = False, intrinsicCameraMatrix = None, distortionCoefficients = None, undistortedImageMultiplication = 1.):
1665 cvutils.displayTrajectories(videoFilename, [self], homography = homography, firstFrameNum = self.getFirstInstant(), lastFrameNumArg = self.getLastInstant(), undistort = undistort, intrinsicCameraMatrix = intrinsicCameraMatrix, distortionCoefficients = distortionCoefficients, undistortedImageMultiplication = undistortedImageMultiplication) 1665 cvutils.displayTrajectories(videoFilename, [self], homography = homography, firstFrameNum = self.getFirstInstant(), lastFrameNumArg = self.getLastInstant(), undistort = undistort, intrinsicCameraMatrix = intrinsicCameraMatrix, distortionCoefficients = distortionCoefficients, undistortedImageMultiplication = undistortedImageMultiplication)
1666 1666
1667 def speedDiagnostics(self, framerate = 1., display = False, nInstantsIgnoredAtEnds=0): 1667 def speedDiagnostics(self, framerate = 1., display = False, nInstantsIgnoredAtEnds=0):