@@ -181,6 +181,11 @@ def main():
181181 # 追跡アップデート
182182 start_time = time .time ()
183183 ok , bbox = tracker .update (image )
184+ try :
185+ tracker_score = tracker .getTrackingScore ()
186+ except :
187+ tracker_score = '-'
188+ 184189 elapsed_time_list .append (time .time () - start_time )
185190 if ok :
186191 # 追跡後のバウンディングボックス描画
@@ -196,11 +201,18 @@ def main():
196201
197202 # 各アルゴリズム処理時間描画
198203 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 )
204216
205217 cv .imshow (window_name , debug_image )
206218
0 commit comments