@@ -181,6 +181,11 @@ def main():
181
181
# 追跡アップデート
182
182
start_time = time .time ()
183
183
ok , bbox = tracker .update (image )
184
+ try :
185
+ tracker_score = tracker .getTrackingScore ()
186
+ except :
187
+ tracker_score = '-'
188
+
184
189
elapsed_time_list .append (time .time () - start_time )
185
190
if ok :
186
191
# 追跡後のバウンディングボックス描画
@@ -196,11 +201,18 @@ def main():
196
201
197
202
# 各アルゴリズム処理時間描画
198
203
for index , tracker_algorithm in enumerate (tracker_algorithm_list ):
199
- cv .putText (
200
- debug_image , tracker_algorithm + " : " +
201
- '{:.1f}' .format (elapsed_time_list [index ] * 1000 ) + "ms" ,
202
- (10 , int (25 * (index + 1 ))), cv .FONT_HERSHEY_SIMPLEX , 0.7 ,
203
- color_list [index ], 2 , cv .LINE_AA )
204
+ if tracker_score != '-' :
205
+ cv .putText (
206
+ debug_image , tracker_algorithm + " : " +
207
+ '{:.1f}' .format (elapsed_time_list [index ] * 1000 ) + "ms" + ' Score:{:.2f}' .format (tracker_score ),
208
+ (10 , int (25 * (index + 1 ))), cv .FONT_HERSHEY_SIMPLEX , 0.7 ,
209
+ color_list [index ], 2 , cv .LINE_AA )
210
+ else :
211
+ cv .putText (
212
+ debug_image , tracker_algorithm + " : " +
213
+ '{:.1f}' .format (elapsed_time_list [index ] * 1000 ) + "ms" ,
214
+ (10 , int (25 * (index + 1 ))), cv .FONT_HERSHEY_SIMPLEX , 0.7 ,
215
+ color_list [index ], 2 , cv .LINE_AA )
204
216
205
217
cv .imshow (window_name , debug_image )
206
218
0 commit comments