Mercurial > hg > nsaunier > traffic-intelligence
comparison python/moving.py @ 621:582508610572
merge and updated consistently that imageheight does not seem necessary anymore for plotting on world image
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 10 Dec 2014 15:29:57 -0500 |
| parents | dc2d0a0d7fe1 aee4cbac9e0e |
| children | dc8490726d06 |
comparison
equal
deleted
inserted
replaced
| 619:dc2d0a0d7fe1 | 621:582508610572 |
|---|---|
| 682 Trajectory._plot(self.positions, options, withOrigin, None, timeStep, **kwargs) | 682 Trajectory._plot(self.positions, options, withOrigin, None, timeStep, **kwargs) |
| 683 | 683 |
| 684 def plotAt(self, lastCoordinate, options = '', withOrigin = False, timeStep = 1, **kwargs): | 684 def plotAt(self, lastCoordinate, options = '', withOrigin = False, timeStep = 1, **kwargs): |
| 685 Trajectory._plot(self.positions, options, withOrigin, lastCoordinate, timeStep, **kwargs) | 685 Trajectory._plot(self.positions, options, withOrigin, lastCoordinate, timeStep, **kwargs) |
| 686 | 686 |
| 687 def plotOnWorldImage(self, nPixelsPerUnitDistance, imageHeight, options = '', withOrigin = False, timeStep = 1, **kwargs): | 687 def plotOnWorldImage(self, nPixelsPerUnitDistance, options = '', withOrigin = False, timeStep = 1, **kwargs): |
| 688 from matplotlib.pylab import plot | |
| 689 imgPositions = [[x*nPixelsPerUnitDistance for x in self.positions[0]], | 688 imgPositions = [[x*nPixelsPerUnitDistance for x in self.positions[0]], |
| 690 [-x*nPixelsPerUnitDistance+imageHeight for x in self.positions[1]]] | 689 [x*nPixelsPerUnitDistance for x in self.positions[1]]] |
| 691 Trajectory._plot(imgPositions, options, withOrigin, timeStep, **kwargs) | 690 Trajectory._plot(imgPositions, options, withOrigin, None, timeStep, **kwargs) |
| 692 | 691 |
| 693 def getXCoordinates(self): | 692 def getXCoordinates(self): |
| 694 return self.positions[0] | 693 return self.positions[0] |
| 695 | 694 |
| 696 def getYCoordinates(self): | 695 def getYCoordinates(self): |
| 1012 f.positions.plot('r', True, timeStep, **kwargs) | 1011 f.positions.plot('r', True, timeStep, **kwargs) |
| 1013 self.positions.plot('bx-', True, timeStep, **kwargs) | 1012 self.positions.plot('bx-', True, timeStep, **kwargs) |
| 1014 else: | 1013 else: |
| 1015 self.positions.plot(options, withOrigin, timeStep, **kwargs) | 1014 self.positions.plot(options, withOrigin, timeStep, **kwargs) |
| 1016 | 1015 |
| 1017 def plotOnWorldImage(self, nPixelsPerUnitDistance, imageHeight, options = '', withOrigin = False, timeStep = 1, **kwargs): | 1016 def plotOnWorldImage(self, nPixelsPerUnitDistance, options = '', withOrigin = False, timeStep = 1, **kwargs): |
| 1018 self.positions.plotOnWorldImage(nPixelsPerUnitDistance, imageHeight, options, withOrigin, timeStep, **kwargs) | 1017 self.positions.plotOnWorldImage(nPixelsPerUnitDistance, options, withOrigin, timeStep, **kwargs) |
| 1019 | 1018 |
| 1020 def play(self, videoFilename, homography = None): | 1019 def play(self, videoFilename, homography = None): |
| 1021 cvutils.displayTrajectories(videoFilename, [self], homography, self.getFirstInstant(), self.getLastInstant()) | 1020 cvutils.displayTrajectories(videoFilename, [self], homography, self.getFirstInstant(), self.getLastInstant()) |
| 1022 | 1021 |
| 1023 def speedDiagnostics(self, framerate = 1., display = False): | 1022 def speedDiagnostics(self, framerate = 1., display = False): |
