# HG changeset patch # User Nicolas Saunier # Date 1340695797 14400 # Node ID c31722fcc9de12107c92f45909bbb83774a6ffaa # Parent 426321b46e44422224d203239624b9c3005b82fa minor modifications for integer drawing in OpenCV diff -r 426321b46e44 -r c31722fcc9de python/cvutils.py --- a/python/cvutils.py Tue Jun 26 02:08:01 2012 -0400 +++ b/python/cvutils.py Tue Jun 26 03:29:57 2012 -0400 @@ -90,7 +90,7 @@ if lastCoordinate != None and lastCoordinate >=0: last = min(positions.length()-1, lastCoordinate) for i in range(0, last-1): - cv2.line(img, positions[i].astuple(), positions[i+1].astuple(), color) + cv2.line(img, positions[i].asint().astuple(), positions[i+1].asint().astuple(), color) def playVideo(filename): '''Plays the video''' @@ -142,7 +142,7 @@ else: obj.projectedPositions = obj.positions draw(img, obj.projectedPositions, cvRed, frameNum-obj.getFirstInstant()) - cv2.putText(img, '{0}'.format(obj.num), obj.projectedPositions[frameNum-obj.getFirstInstant()].astuple(), cv2.FONT_HERSHEY_PLAIN, 1, cvRed) + cv2.putText(img, '{0}'.format(obj.num), obj.projectedPositions[frameNum-obj.getFirstInstant()].asint().astuple(), cv2.FONT_HERSHEY_PLAIN, 1, cvRed) cv2.imshow('frame', img) key = cv2.waitKey(50) frameNum += 1 diff -r 426321b46e44 -r c31722fcc9de python/moving.py --- a/python/moving.py Tue Jun 26 02:08:01 2012 -0400 +++ b/python/moving.py Tue Jun 26 03:29:57 2012 -0400 @@ -159,6 +159,9 @@ def astuple(self): return (self.x, self.y) + def asint(self): + return Point(int(self.x), int(self.y)) + def project(self, homography): from numpy.core.multiarray import array projected = cvutils.projectArray(homography, array([[self.x], [self.y]]))