diff python/cvutils.py @ 946:e5970606066f

bug fix on list filtering (cannot remove while iterating) and motion prediction keeping the same features
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 21 Jul 2017 11:25:20 -0400
parents 56cc8a1f7082
children 053484e08947
line wrap: on
line diff
--- a/python/cvutils.py	Thu Jul 20 14:29:46 2017 -0400
+++ b/python/cvutils.py	Fri Jul 21 11:25:20 2017 -0400
@@ -344,8 +344,7 @@
                                 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)
+                    objects[:] = [obj for obj in objects if obj.getLastInstant() != frameNum]
                     # plot object bounding boxes
                     if frameNum in boundingBoxes.keys():
                         for rect in boundingBoxes[frameNum]: