@@ -92,6 +92,25 @@ def getFrame(sec):
92
92
print ('\t %s (%.2f): x=%d y=%d w=%d h=%d' % (bb ['label' ], bb ['value' ], bb ['x' ], bb ['y' ], bb ['width' ], bb ['height' ]))
93
93
img = cv2 .rectangle (cropped , (bb ['x' ], bb ['y' ]), (bb ['x' ] + bb ['width' ], bb ['y' ] + bb ['height' ]), (255 , 0 , 0 ), 1 )
94
94
95
+ # Object tracking output
96
+ if "object_tracking" in res ["result" ].keys ():
97
+ print ('Found %d tracked objects' % (len (res ["result" ]["object_tracking" ])))
98
+ for obj in res ["result" ]["object_tracking" ]:
99
+ print ('\t ID=%s, label=%s, value=%.2f, x=%d, y=%d, w=%d, h=%d' % (
100
+ obj ['object_id' ], obj ['label' ], obj ['value' ], obj ['x' ], obj ['y' ], obj ['width' ], obj ['height' ]))
101
+ # Draw bounding box
102
+ x = obj ['x' ]
103
+ y = obj ['y' ]
104
+ w = obj ['width' ]
105
+ h = obj ['height' ]
106
+ img = cv2 .rectangle (cropped , (x , y ), (x + w , y + h ), (0 , 255 , 0 ), 2 )
107
+ # Draw label and ID
108
+ label_id_text = f"ID={ obj ['object_id' ]} , { obj ['label' ]} "
109
+ text_x = x
110
+ text_y = y - 10 if y - 10 > 10 else y + 20
111
+ img = cv2 .putText (img , label_id_text , (text_x , text_y ),
112
+ cv2 .FONT_HERSHEY_SIMPLEX , 0.5 , (0 , 255 , 0 ), 2 )
113
+
95
114
if "visual_anomaly_grid" in res ["result" ].keys ():
96
115
print ('Found %d visual anomalies (%d ms.)' % (len (res ["result" ]["visual_anomaly_grid" ]), res ['timing' ]['dsp' ] +
97
116
res ['timing' ]['classification' ] +
0 commit comments