Mercurial Hosting > traffic-intelligence
diff python/cvutils.py @ 636:3058e00887bc
removed all issues because of tests with None, using is instead of == or !=
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 24 Mar 2015 18:11:28 +0100 |
parents | 977407c9f815 |
children | 852f5de42d01 |
line wrap: on
line diff
--- a/python/cvutils.py Tue Mar 24 14:17:12 2015 +0100 +++ b/python/cvutils.py Tue Mar 24 18:11:28 2015 +0100 @@ -95,7 +95,7 @@ def cvPlot(img, positions, color, lastCoordinate = None): last = lastCoordinate+1 - if lastCoordinate != None and lastCoordinate >=0: + if lastCoordinate is not None and lastCoordinate >=0: last = min(positions.length()-1, lastCoordinate) for i in range(0, last-1): cv2.line(img, positions[i].asint().astuple(), positions[i+1].asint().astuple(), color) @@ -140,7 +140,7 @@ if printFrames: print('frame {0}'.format(frameNum)) frameNum+=1 - if text != None: + if text is not None: cv2.putText(img, text, (10,50), cv2.cv.CV_FONT_HERSHEY_PLAIN, 1, cvRed) cvImshow(windowName, img, rescale) key = cv2.waitKey(wait) @@ -234,7 +234,7 @@ ret = True frameNum = firstFrameNum capture.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, firstFrameNum) - if lastFrameNumArg == None: + if lastFrameNumArg is None: from sys import maxint lastFrameNum = maxint else: @@ -250,7 +250,7 @@ for obj in objects: if obj.existsAtInstant(frameNum): if not hasattr(obj, 'projectedPositions'): - if homography != None: + if homography is not None: obj.projectedPositions = obj.positions.project(homography) else: obj.projectedPositions = obj.positions @@ -422,7 +422,7 @@ if points.shape[0] != 2: raise Exception('points of dimension {0} {1}'.format(points.shape[0], points.shape[1])) - if (homography!=None) and homography.size>0: + if (homography is not None) and homography.size>0: augmentedPoints = append(points,[[1]*points.shape[1]], 0) prod = dot(homography, augmentedPoints) return prod[0:2]/prod[2]