官术网_书友最值得收藏!

Reading a video file

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 display a video file using cv2.VideoCapture

主站蜘蛛池模板: 南丹县| 景东| 三台县| 蓬溪县| 祁连县| 吐鲁番市| 孟村| 上蔡县| 凌海市| 河西区| 团风县| 新建县| 安平县| 化德县| 会东县| 大石桥市| 聊城市| 闻喜县| 平罗县| 呼和浩特市| 镶黄旗| 辉南县| 公安县| 伽师县| 当雄县| 广宁县| 八宿县| 泗洪县| 万荣县| 克东县| 云和县| 姜堰市| 蓬溪县| 甘泉县| 会昌县| 天津市| 佳木斯市| 青海省| 泉州市| 库伦旗| 河源市|