February 2020
Intermediate to advanced
372 pages
9h 26m
English
Now that we have a Pedestrian class to maintain data about the tracking of each pedestrian, let's implement our program's main function. We will look at the parts of the implementation sequentially:
def main(): cap = cv2.VideoCapture('pedestrians.avi') # Create the KNN background subtractor. bg_subtractor = cv2.createBackgroundSubtractorKNN() history_length = 20 bg_subtractor.setHistory(history_length)
erode_kernel = cv2.getStructuringElement( cv2.MORPH_ELLIPSE, (3, 3))dilate_kernel ...