Mercurial Hosting > traffic-intelligence
comparison python/cvutils.py @ 116:2bf5b76320c0
moved intersection plotting and added markers for scatter plots
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 08 Aug 2011 14:47:30 -0400 |
parents | 67555e968b5e |
children | 0f552c8b1650 |
comparison
equal
deleted
inserted
replaced
115:550556378466 | 116:2bf5b76320c0 |
---|---|
125 deltaY.append(dy) | 125 deltaY.append(dy) |
126 if len(deltaX) >= 10: | 126 if len(deltaX) >= 10: |
127 return [median(deltaX), median(deltaY)] | 127 return [median(deltaX), median(deltaY)] |
128 else: | 128 else: |
129 return None | 129 return None |
130 | |
131 class FourWayIntersection: | |
132 '''Simple class for simple intersection outline''' | |
133 def __init__(self, dimension, coordX, coordY): | |
134 self.dimension = dimension | |
135 self.coordX = coordX | |
136 self.coordY = coordY | |
137 | |
138 def plot(self, options = 'k'): | |
139 from matplotlib.pyplot import plot, axis | |
140 | |
141 minX = min(self.dimension[0]) | |
142 maxX = max(self.dimension[0]) | |
143 minY = min(self.dimension[1]) | |
144 maxY = max(self.dimension[1]) | |
145 | |
146 plot([minX, self.coordX[0], self.coordX[0]], [self.coordY[0], self.coordY[0], minY],options) | |
147 plot([self.coordX[1], self.coordX[1], maxX], [minY, self.coordY[0], self.coordY[0]],options) | |
148 plot([minX, self.coordX[0], self.coordX[0]], [self.coordY[1], self.coordY[1], maxY],options) | |
149 plot([self.coordX[1], self.coordX[1], maxX], [maxY, self.coordY[1], self.coordY[1]],options) | |
150 axis('equal') |