Mercurial Hosting > traffic-intelligence
comparison python/moving.py @ 517:47d9970ee954
added plotting of features with object
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 06 Jun 2014 17:51:10 -0400 |
parents | bce1fe45d1b2 |
children | fd9641cbd24b |
comparison
equal
deleted
inserted
replaced
516:bce1fe45d1b2 | 517:47d9970ee954 |
---|---|
683 super(MovingObject, self).__init__(num, timeInterval) | 683 super(MovingObject, self).__init__(num, timeInterval) |
684 self.positions = positions | 684 self.positions = positions |
685 self.velocities = velocities | 685 self.velocities = velocities |
686 self.geometry = geometry | 686 self.geometry = geometry |
687 self.userType = userType | 687 self.userType = userType |
688 self.features = None | 688 self.features = [] |
689 # compute bounding polygon from trajectory | 689 # compute bounding polygon from trajectory |
690 | 690 |
691 def getObjectInTimeInterval(self, inter): | 691 def getObjectInTimeInterval(self, inter): |
692 '''Returns a new object extracted from self, | 692 '''Returns a new object extracted from self, |
693 restricted to time interval inter''' | 693 restricted to time interval inter''' |
745 return self.positions.getXCoordinates() | 745 return self.positions.getXCoordinates() |
746 | 746 |
747 def getYCoordinates(self): | 747 def getYCoordinates(self): |
748 return self.positions.getYCoordinates() | 748 return self.positions.getYCoordinates() |
749 | 749 |
750 def plot(self, options = '', withOrigin = False, timeStep = 1, **kwargs): | 750 def plot(self, options = '', withOrigin = False, timeStep = 1, withFeatures = False, **kwargs): |
751 self.positions.plot(options, withOrigin, timeStep, **kwargs) | 751 if withFeatures: |
752 for f in self.features: | |
753 f.positions.plot('r', True, timeStep, **kwargs) | |
754 self.positions.plot('bx-', True, timeStep, **kwargs) | |
755 else: | |
756 self.positions.plot(options, withOrigin, timeStep, **kwargs) | |
752 | 757 |
753 def plotOnWorldImage(self, nPixelsPerUnitDistance, imageHeight, options = '', withOrigin = False, timeStep = 1, **kwargs): | 758 def plotOnWorldImage(self, nPixelsPerUnitDistance, imageHeight, options = '', withOrigin = False, timeStep = 1, **kwargs): |
754 self.positions.plotOnWorldImage(nPixelsPerUnitDistance, imageHeight, options, withOrigin, timeStep, **kwargs) | 759 self.positions.plotOnWorldImage(nPixelsPerUnitDistance, imageHeight, options, withOrigin, timeStep, **kwargs) |
755 | 760 |
756 def play(self, videoFilename, homography = None): | 761 def play(self, videoFilename, homography = None): |