Mercurial Hosting > traffic-intelligence
diff python/cvutils.py @ 515:727e3c529519
renamed all draw functions to plot for consistency
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 06 Jun 2014 14:10:42 -0400 |
parents | ad518f0c3218 |
children | fd9641cbd24b |
line wrap: on
line diff
--- a/python/cvutils.py Thu Jun 05 17:50:42 2014 -0400 +++ b/python/cvutils.py Fri Jun 06 14:10:42 2014 -0400 @@ -36,7 +36,7 @@ def saveKey(key): return chr(key&255) == 's' -def drawLines(filename, origins, destinations, w = 1, resultFilename='image.png'): +def plotLines(filename, origins, destinations, w = 1, resultFilename='image.png'): '''Draws lines over the image ''' import Image, ImageDraw # PIL @@ -48,7 +48,7 @@ for p1, p2 in zip(origins, destinations): draw.line([p1.x, p1.y, p2.x, p2.y], width = w, fill = (256,0,0)) #draw.line([p1.x, p1.y, p2.x, p2.y], pen) - del draw + del draw #out = utils.openCheck(resultFilename) img.save(resultFilename) @@ -93,7 +93,7 @@ cvmat[i,j] = a[i,j] return cvmat - def draw(img, positions, color, lastCoordinate = None): + def cvPlot(img, positions, color, lastCoordinate = None): last = lastCoordinate+1 if lastCoordinate != None and lastCoordinate >=0: last = min(positions.length()-1, lastCoordinate) @@ -247,7 +247,7 @@ obj.projectedPositions = obj.positions.project(homography) else: obj.projectedPositions = obj.positions - draw(img, obj.projectedPositions, cvRed, frameNum-obj.getFirstInstant()) + cvPlot(img, obj.projectedPositions, cvRed, frameNum-obj.getFirstInstant()) if frameNum in boundingBoxes.keys(): for rect in boundingBoxes[frameNum]: cv2.rectangle(img, rect[0].asint().astuple(), rect[1].asint().astuple(), cvRed)