- use bbox_tracker_ext

- reduced line thickness
This commit is contained in:
2024-06-30 23:03:12 +02:00
parent 9aeb49bf19
commit 50bb0433f1
+5 -5
View File
@@ -6,7 +6,7 @@ from template_matcher import template_match_rotation
from util import bbox_extend, bbox_round, process_image_bbox, image_crop, bbox_add_position, to_rect from util import bbox_extend, bbox_round, process_image_bbox, image_crop, bbox_add_position, to_rect
IMG_SCALE_UP = 1 IMG_SCALE_UP = 1
TEMPLATE_MATCH_OVERLAP = 1.0 TEMPLATE_MATCH_OVERLAP = 0.5
def match(source, template, angle, center): def match(source, template, angle, center):
@@ -116,17 +116,17 @@ while True:
# Matcher # Matcher
matcher_bbox = (max_loc[0], max_loc[1], image_template.shape[1], image_template.shape[0]) matcher_bbox = (max_loc[0], max_loc[1], image_template.shape[1], image_template.shape[0])
matcher_bbox_global = bbox_round(bbox_add_position(matcher_bbox, bbox_tracker)) matcher_bbox_global = bbox_round(bbox_add_position(matcher_bbox, bbox_tracker_ext))
matcher_top_left, matcher_bottom_right = to_rect(matcher_bbox_global) matcher_top_left, matcher_bottom_right = to_rect(matcher_bbox_global)
cv2.rectangle(frame, matcher_top_left, matcher_bottom_right, (255, 0, 0), 3) cv2.rectangle(frame, matcher_top_left, matcher_bottom_right, (255, 0, 0), 2)
# Tracker # Tracker
tracker_top_left, tracker_bottom_right = to_rect(bbox_round(bbox_tracker)) tracker_top_left, tracker_bottom_right = to_rect(bbox_round(bbox_tracker))
cv2.rectangle(frame, tracker_top_left, tracker_bottom_right, (0, 0, 255), 3) cv2.rectangle(frame, tracker_top_left, tracker_bottom_right, (0, 0, 255), 2)
# Tracker ext # Tracker ext
tracker_top_left, tracker_bottom_right = to_rect(bbox_round(bbox_tracker_ext)) tracker_top_left, tracker_bottom_right = to_rect(bbox_round(bbox_tracker_ext))
cv2.rectangle(frame, tracker_top_left, tracker_bottom_right, (255, 0, 255), 3) cv2.rectangle(frame, tracker_top_left, tracker_bottom_right, (255, 0, 255), 2)
# Calculate Frames per second (FPS) # Calculate Frames per second (FPS)
fps = cv2.getTickFrequency() / (cv2.getTickCount() - timer) fps = cv2.getTickFrequency() / (cv2.getTickCount() - timer)