March 2019
Intermediate to advanced
532 pages
13h 2m
English
cv2.VideoCapture also allows us to read a video file. Therefore, to read a video file, the path to the video file should be provided when creating the cv2.VideoCapture object:
# We first create the ArgumentParser object # The created object 'parser' will have the necessary information# to parse the command-line arguments into data types.parser = argparse.ArgumentParser()# We add 'video_path' argument using add_argument() including a help.parser.add_argument("video_path", help="path to the video file")args = parser.parse_args()# Create a VideoCapture object. In this case, the argument is the video file name:capture = cv2.VideoCapture(args.video_path)
Check out read_video_file.py to see the full example of how to read and ...