- refactored
- use MOSSE tracker
This commit is contained in:
+5
-3
@@ -78,7 +78,7 @@ trackers = {
|
||||
'BOOSTING': cv2.legacy.TrackerBoosting,
|
||||
'MEDIANFLOW': cv2.legacy.TrackerMedianFlow
|
||||
}
|
||||
tracker_type = 'KCF'
|
||||
tracker_type = 'MOSSE'
|
||||
tracker = trackers[tracker_type].create()
|
||||
|
||||
video = cv2.VideoCapture("./data/production_id 4525346 (1080p).mp4")
|
||||
@@ -120,17 +120,19 @@ while True:
|
||||
image_template_rotated = image_template
|
||||
|
||||
if ok:
|
||||
current_angle, best_maxLoc = match(image_bbox, image_template, current_angle)
|
||||
current_angle, max_loc = match(image_bbox, image_template, current_angle)
|
||||
image_template_rotated = im.rotate(image_template, current_angle)
|
||||
|
||||
# determine the starting and ending (x, y)-coordinates of the
|
||||
# bounding box
|
||||
(startX, startY) = best_maxLoc
|
||||
(startX, startY) = max_loc
|
||||
startX += bbox[0]
|
||||
startY += bbox[1]
|
||||
endX = startX + bbox[2]
|
||||
endY = startY + bbox[3]
|
||||
|
||||
print(f"startX: {startX}, startY: {startY}")
|
||||
|
||||
# draw the bounding box on the image
|
||||
p1 = (int(bbox[0]), int(bbox[1]))
|
||||
p2 = (int(bbox[0] + bbox[2]), int(bbox[1] + bbox[3]))
|
||||
|
||||
Reference in New Issue
Block a user