Mercurial Hosting > traffic-intelligence
comparison python/cvutils.py @ 44:be3ae926e4e8
added simple intersection description, function to load collision points
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Sat, 31 Jul 2010 23:39:17 -0400 |
parents | 9ae709a2e8d0 |
children | 8aed225f71d8 |
comparison
equal
deleted
inserted
replaced
43:6d11d9e7ad4e | 44:be3ae926e4e8 |
---|---|
1 #! /usr/bin/env python | 1 #! /usr/bin/env python |
2 '''Image/Video utilities''' | 2 '''Image/Video utilities''' |
3 | 3 |
4 import Image, ImageDraw # PIL | 4 import Image, ImageDraw # PIL |
5 import aggdraw # agg on top of PIL (antialiased drawing) | 5 #import aggdraw # agg on top of PIL (antialiased drawing) |
6 from moving import Point | 6 from moving import Point |
7 #import utils | 7 #import utils |
8 | 8 |
9 __metaclass__ = type | 9 __metaclass__ = type |
10 | 10 |
49 pp = project(homography, p) | 49 pp = project(homography, p) |
50 projected[0].append(pp[0]) | 50 projected[0].append(pp[0]) |
51 projected[1].append(pp[1]) | 51 projected[1].append(pp[1]) |
52 return projected | 52 return projected |
53 | 53 |
54 class WorldSpaceData: | |
55 '''Simple class for simple intersection outline''' | |
56 def __init__(self, dimension, coordX, coordY): | |
57 self.dimension = dimension | |
58 self.coordX = coordX | |
59 self.coordY = coordY | |
60 | |
61 def plot(self, options = 'k'): | |
62 from matplotlib.pyplot import plot, axis | |
63 | |
64 minX = min(self.dimension[0]) | |
65 maxX = max(self.dimension[0]) | |
66 minY = min(self.dimension[1]) | |
67 maxY = max(self.dimension[1]) | |
68 | |
69 plot([minX, self.coordX[0], self.coordX[0]], [self.coordY[0], self.coordY[0], minY],options) | |
70 plot([self.coordX[1], self.coordX[1], maxX], [minY, self.coordY[0], self.coordY[0]],options) | |
71 plot([minX, self.coordX[0], self.coordX[0]], [self.coordY[1], self.coordY[1], maxY],options) | |
72 plot([self.coordX[1], self.coordX[1], maxX], [maxY, self.coordY[1], self.coordY[1]],options) | |
73 axis('equal') |