Mercurial Hosting > traffic-intelligence
comparison python/cvutils.py @ 658:6668f541b915
Added **kwargs passthrough to cvPlot()->cv2.line() for greater drawing flexibility.
author | pstaub |
---|---|
date | Thu, 14 May 2015 19:48:09 +0200 |
parents | 51269511229b |
children | dc70d9e711f5 |
comparison
equal
deleted
inserted
replaced
657:51269511229b | 658:6668f541b915 |
---|---|
97 for i in range(cvmat.rows): | 97 for i in range(cvmat.rows): |
98 for j in range(cvmat.cols): | 98 for j in range(cvmat.cols): |
99 cvmat[i,j] = a[i,j] | 99 cvmat[i,j] = a[i,j] |
100 return cvmat | 100 return cvmat |
101 | 101 |
102 def cvPlot(img, positions, color, lastCoordinate = None): | 102 def cvPlot(img, positions, color, lastCoordinate = None, **kwargs): |
103 last = lastCoordinate+1 | 103 last = lastCoordinate+1 |
104 if lastCoordinate is not None and lastCoordinate >=0: | 104 if lastCoordinate is not None and lastCoordinate >=0: |
105 last = min(positions.length()-1, lastCoordinate) | 105 last = min(positions.length()-1, lastCoordinate) |
106 for i in range(0, last-1): | 106 for i in range(0, last-1): |
107 cv2.line(img, positions[i].asint().astuple(), positions[i+1].asint().astuple(), color) | 107 cv2.line(img, positions[i].asint().astuple(), positions[i+1].asint().astuple(), color, **kwargs) |
108 | 108 |
109 def cvImshow(windowName, img, rescale = 1.0): | 109 def cvImshow(windowName, img, rescale = 1.0): |
110 'Rescales the image (in particular if too large)' | 110 'Rescales the image (in particular if too large)' |
111 from cv2 import resize | 111 from cv2 import resize |
112 if rescale != 1.: | 112 if rescale != 1.: |