Mercurial Hosting > traffic-intelligence
comparison python/moving.py @ 377:2aed569f39e7
added utils
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 18 Jul 2013 02:08:51 -0400 |
parents | 349eb1e09f45 |
children | 3805b9639647 |
comparison
equal
deleted
inserted
replaced
376:2e6b8610bcaa | 377:2aed569f39e7 |
---|---|
685 self.positions.drawOnWorldImage(nPixelsPerUnitDistance, imageHeight, options, withOrigin, timeStep, **kwargs) | 685 self.positions.drawOnWorldImage(nPixelsPerUnitDistance, imageHeight, options, withOrigin, timeStep, **kwargs) |
686 | 686 |
687 def play(self, videoFilename, homography = None): | 687 def play(self, videoFilename, homography = None): |
688 cvutils.displayTrajectories(videoFilename, [self], homography, self.getFirstInstant(), self.getLastInstant()) | 688 cvutils.displayTrajectories(videoFilename, [self], homography, self.getFirstInstant(), self.getLastInstant()) |
689 | 689 |
690 def speedDiagnostics(self, display = False): | |
691 from numpy import std | |
692 speeds = self.getSpeeds() | |
693 coef = utils.linearRegression(range(len(speeds)), speeds) | |
694 print(speeds[-2]-speeds[1], std(speeds), coef[0]) | |
695 if display: | |
696 from matplotlib.pyplot import figure, plot | |
697 figure(1) | |
698 self.draw() | |
699 figure(2) | |
700 plot(list(self.getTimeInterval()), speeds) | |
701 | |
690 def getInstantsCrossingLane(self, p1, p2): | 702 def getInstantsCrossingLane(self, p1, p2): |
691 '''Returns the instant(s) | 703 '''Returns the instant(s) |
692 at which the object passes from one side of the segment to the other | 704 at which the object passes from one side of the segment to the other |
693 empty list if there is no crossing''' | 705 empty list if there is no crossing''' |
694 indices = self.positions.getIntersections(p1, p2) | 706 indices = self.positions.getIntersections(p1, p2) |