Skip to content

Commit aa1e640

Browse files
authored
Merge pull request #2 from alfonnews/feature_score
Adds tracking score visualization if its posible
2 parents 2550579 + f9a6dad commit aa1e640

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

performance_comparison_sample.py

+17-5
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)