Mercurial > hg > nsaunier > traffic-intelligence
comparison python/cvutils.py @ 48:8aed225f71d8
rearranged code for function readline and getlines (and characters), moved invertHomography to cvutils
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Thu, 23 Sep 2010 17:24:31 -0400 |
| parents | be3ae926e4e8 |
| children | 1d36a676c745 |
comparison
equal
deleted
inserted
replaced
| 47:e27598865af3 | 48:8aed225f71d8 |
|---|---|
| 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 def invertHomography(homography): | |
| 55 'Returns an inverted homography' | |
| 56 from numpy.linalg.linalg import inv | |
| 57 invH = inv(homography) | |
| 58 invH /= invH[2,2] | |
| 59 return invH | |
| 60 | |
| 54 class WorldSpaceData: | 61 class WorldSpaceData: |
| 55 '''Simple class for simple intersection outline''' | 62 '''Simple class for simple intersection outline''' |
| 56 def __init__(self, dimension, coordX, coordY): | 63 def __init__(self, dimension, coordX, coordY): |
| 57 self.dimension = dimension | 64 self.dimension = dimension |
| 58 self.coordX = coordX | 65 self.coordX = coordX |
