March 2020
Intermediate to advanced
366 pages
9h 8m
English
The constructor of the tracker class is straightforward. All it does is set up the termination criteria for mean-shift tracking and store the conditions for the minimum contour area (min_area) and the minimum average speed normalized by object size (min_speed_per_pix) to be considered in the subsequent computation steps:
def __init__(self, min_object_area: int = 400, min_speed_per_pix: float = 0.02): self.object_boxes = [] self.min_object_area = min_object_area self.min_speed_per_pix = min_speed_per_pix self.num_frame_tracked = 0 # Setup the termination criteria, either 100 iteration or move by at # least 1 pt self.term_crit = (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 5, 1)
From then on, ...