diff python/cvutils.py @ 661:dc70d9e711f5

some method name change and new methods for features in objects (MovingObject) and methods to access indicator values in interactions
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Mon, 18 May 2015 13:53:25 +0200
parents 6668f541b915
children 15e244d2a1b5
line wrap: on
line diff
--- a/python/cvutils.py	Fri May 15 23:09:49 2015 +0200
+++ b/python/cvutils.py	Mon May 18 13:53:25 2015 +0200
@@ -238,11 +238,12 @@
         'Computes the bounding box of object at frameNum'
         x = []
         y = []
-        for f in obj.features:
-            if f.existsAtInstant(frameNum):
-                projectedPosition = f.getPositionAtInstant(frameNum).project(homography)
-                x.append(projectedPosition.x)
-                y.append(projectedPosition.y)
+        if obj.hasFeatures():
+            for f in obj.getFeatures():
+                if f.existsAtInstant(frameNum):
+                    projectedPosition = f.getPositionAtInstant(frameNum).project(homography)
+                    x.append(projectedPosition.x)
+                    y.append(projectedPosition.y)
         xmin = min(x)
         xmax = max(x)
         ymin = min(y)
@@ -304,7 +305,7 @@
                             if frameNum in boundingBoxes.keys():
                                 for rect in boundingBoxes[frameNum]:
                                     cv2.rectangle(img, rect[0].asint().astuple(), rect[1].asint().astuple(), cvRed)
-                            elif len(obj.features) != 0:
+                            elif obj.hasFeatures():
                                 imgcrop, yCropMin, yCropMax, xCropMin, xCropMax = imageBox(img, obj, frameNum, homography, width, height)
                                 cv2.rectangle(img, (xCropMin, yCropMin), (xCropMax, yCropMax), cvBlue, 1)
                             objDescription = '{} '.format(obj.num)