@@ -170,6 +170,11 @@ def main():
170
170
# 追跡アップデート
171
171
start_time = time .time ()
172
172
ok , bbox = tracker .update (image )
173
+ try :
174
+ tracker_score = tracker .getTrackingScore ()
175
+ except :
176
+ tracker_score = '-'
177
+
173
178
elapsed_time_list .append (time .time () - start_time )
174
179
if ok :
175
180
# 追跡後のバウンディングボックス描画
@@ -185,11 +190,18 @@ def main():
185
190
186
191
# 各アルゴリズム処理時間描画
187
192
for index , tracker_algorithm in enumerate (tracker_algorithm_list ):
188
- cv .putText (
189
- debug_image , tracker_algorithm + " : " +
190
- '{:.1f}' .format (elapsed_time_list [index ] * 1000 ) + "ms" ,
191
- (10 , int (25 * (index + 1 ))), cv .FONT_HERSHEY_SIMPLEX , 0.7 ,
192
- color_list [index ], 2 , cv .LINE_AA )
193
+ if tracker_score != '-' :
194
+ cv .putText (
195
+ debug_image , tracker_algorithm + " : " +
196
+ '{:.1f}' .format (elapsed_time_list [index ] * 1000 ) + "ms" + ' Score:{:.2f}' .format (tracker_score ),
197
+ (10 , int (25 * (index + 1 ))), cv .FONT_HERSHEY_SIMPLEX , 0.7 ,
198
+ color_list [index ], 2 , cv .LINE_AA )
199
+ else :
200
+ cv .putText (
201
+ debug_image , tracker_algorithm + " : " +
202
+ '{:.1f}' .format (elapsed_time_list [index ] * 1000 ) + "ms" ,
203
+ (10 , int (25 * (index + 1 ))), cv .FONT_HERSHEY_SIMPLEX , 0.7 ,
204
+ color_list [index ], 2 , cv .LINE_AA )
193
205
194
206
cv .imshow (window_name , debug_image )
195
207
0 commit comments