加载视频显示 - python 实现

python 复制代码
#-*-coding:utf-8-*-
# date:2021-03-21
# Author: DataBall - Xian
# Function: 加载视频并显示

import cv2
if __name__ == "__main__":
    #加载视频
    cap = cv2.VideoCapture('./video/1.mp4')

    while True:
        ret, img = cap.read()# 获取相机图像
        if ret == True:# 如果 ret 返回值为 True,显示图片
            cv2.namedWindow('video',0)
            cv2.imshow("video", img)
            key = cv2.waitKey(33)
            if key == 27:#当按键esc,退出显示
                break
        else:# ret 返回 False,退出循环
            break
            
    cap.release()#释放
    cv2.destroyAllWindows()#关闭显示窗口

​​

助力快速掌握数据集的信息和使用方式。

数据可以如此美好!

相关推荐
databook20 小时前
Manim实现脉冲闪烁特效
后端·python·动效
程序设计实验室20 小时前
2025年了,在 Django 之外,Python Web 框架还能怎么选?
python
倔强青铜三1 天前
苦练Python第46天:文件写入与上下文管理器
人工智能·python·面试
用户2519162427111 天前
Python之语言特点
python
刘立军1 天前
使用pyHugeGraph查询HugeGraph图数据
python·graphql
数据智能老司机1 天前
精通 Python 设计模式——创建型设计模式
python·设计模式·架构
数据智能老司机1 天前
精通 Python 设计模式——SOLID 原则
python·设计模式·架构
c8i1 天前
django中的FBV 和 CBV
python·django
c8i1 天前
python中的闭包和装饰器
python
这里有鱼汤1 天前
小白必看:QMT里的miniQMT入门教程
后端·python