Mercurial Hosting > traffic-intelligence
changeset 903:81ee5aaf213d
changed workflow of display trajectories
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 22 Jun 2017 17:02:03 -0400 |
parents | c69a8defe5c3 |
children | 8f60ecfc2f06 |
files | python/cvutils.py |
diffstat | 1 files changed, 2 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/python/cvutils.py Thu Jun 22 16:57:34 2017 -0400 +++ b/python/cvutils.py Thu Jun 22 17:02:03 2017 -0400 @@ -317,7 +317,6 @@ nZerosFilename = int(ceil(log10(lastFrameNum))) else: nZerosFilename = nZerosFilenameArg - objectToDeleteIds = [] while ret and not quitKey(key) and frameNum <= lastFrameNum: ret, img = capture.read() if ret: @@ -325,14 +324,9 @@ img = cv2.remap(img, map1, map2, interpolation=cv2.INTER_LINEAR) if printFrames: print('frame {0}'.format(frameNum)) - if len(objectToDeleteIds) > 0: - objects = [o for o in objects if o.getNum() not in objectToDeleteIds] - objectToDeleteIds = [] # plot objects for obj in objects: if obj.existsAtInstant(frameNum): - if obj.getLastInstant() == frameNum: - objectToDeleteIds.append(obj.getNum()) if not hasattr(obj, 'projectedPositions'): if homography is not None: obj.projectedPositions = obj.positions.project(homography) @@ -349,6 +343,8 @@ if frameNum not in toMatches[obj.getNum()]: objDescription += " FA" cv2.putText(img, objDescription, obj.projectedPositions[frameNum-obj.getFirstInstant()].asint().astuple(), cv2.FONT_HERSHEY_PLAIN, 1, cvColors[colorType][obj.getNum()]) + if obj.getLastInstant() == frameNum: + objects.remove(obj) # plot object bounding boxes if frameNum in boundingBoxes.keys(): for rect in boundingBoxes[frameNum]: