python实现视频读取和转化图片

作者:hi我是大嘴巴 时间:2023-09-25 08:23:22 

1)视频读取


import cv2

cap = cv2.VideoCapture('E:\\Video\\20000105_224116.dav') #地址

while(True):

ret,frame = cap.read()

if(ret):

# gray = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)

cv2.imshow('input',frame)

else:

break

if cv2.waitKey(1)==27:

break

cap.release()

cv2.destroyAllWindows()

2)转化图片


# -*- coding: utf-8 -*-
"""
Created on Mon Nov 5 15:21:15 2018

@author: chenjin10
"""

import cv2
vc = cv2.VideoCapture('E:\\Video\\binggan.dav')
c=0
rval=vc.isOpened()

while rval:
 c = c + 1
 rval, frame = vc.read()
 if rval:
   cv2.imwrite('E:\\Video\\binggan\\'+'camera1_binggan'+str(c) + '.jpg', frame) #命名方式
   print(c)
 else:
   break
vc.release()

来源:https://blog.csdn.net/weixin_38740463/article/details/83831687

标签:python,视频,转化,图片
0
投稿

猜你喜欢

  • 详解python3 GUI刷屏器(附源码)

    2022-02-02 12:34:15
  • MySQL中字符串索引对update的影响分析

    2024-01-20 19:00:10
  • gorm golang 并发连接数据库报错的解决方法

    2024-01-24 07:54:44
  • 对python中的try、except、finally 执行顺序详解

    2021-07-19 04:08:14
  • python和pyqt实现360的CLable控件

    2021-07-19 13:31:11
  • webpack5搭建一个简易的react脚手架项目实践

    2024-04-18 10:02:37
  • mysql中如何查看表空间

    2024-01-27 00:25:25
  • Python学习之shell脚本的使用详解

    2023-10-01 17:57:51
  • MySQL case when使用方法实例解析

    2024-01-29 03:15:55
  • HTML5本地存储初探(三)

    2010-03-07 15:49:00
  • python处理二进制数据的方法

    2022-09-08 06:20:09
  • 语言编程花絮内建构建顺序示例详解

    2023-11-04 09:42:12
  • Python ORM框架Peewee用法详解

    2022-11-08 03:00:24
  • Win2003服务器安装及设置教程 MySQL安全设置图文教程

    2024-01-28 17:55:46
  • Matplotlib实现各种条形图绘制

    2023-11-20 15:52:51
  • ASP.NET(C#)中操作SQLite数据库实例

    2024-01-20 08:30:12
  • opencv+python识别七段数码显示器的数字(数字识别)

    2022-03-03 00:01:51
  • python optparse模块使用实例

    2021-02-03 22:01:36
  • Python游戏开发之魔塔小游戏的实现

    2022-08-26 16:14:35
  • oracle join on 数据过滤问题

    2009-07-14 21:17:00
  • asp之家 网络编程 m.aspxhome.com