当前位置:网站首页>Video to image -cv2 Videocapture() usage
Video to image -cv2 Videocapture() usage
2022-06-30 00:39:00 【Ning Ranye】
purpose : Video frame extraction , Video visualization
1、cap = cv2.VideoCapture(0)
VideoCapture() Parameter is 0, Indicates that the built-in camera of the notebook is turned on , If the parameter is the path of the video file, open
Such as cap = cv2.VideoCapture(“…/test.avi”)
# If the parameter is the path of the video file, open
cap = cv2.VideoCapture('./RobustPCA_video_demo.avi')
2、ret,frame = cap.read()
cap.read() Read video by frame ,ret,frame Yes cap.read() Method .
among ret Boolean value , If the read frame is correct, return True, If the file reads to the end , Its return value is False.
frame It's the image of every frame , It's a three-dimensional matrix .
3、 cv2.destroyAllWindows() To delete a window ,() No parameters are specified in the , Delete all windows , Delete a specific window , Go to () Enter a specific window value .
4、 call release() Release camera , call destroyAllWindows() Close all image windows .
import cv2
# cv2.VideoCapture Video frame extraction , Video visualization
# If the parameter is the path of the video file, open
cap = cv2.VideoCapture('./RobustPCA_video_demo.avi')
all_frames = []
while(cap.isOpened()):
# ret Boolean value , If the read frame returns correctly true, When reading to the end, it will return false
# frame Is the image of each frame , It's a three-dimensional matrix
ret, frame = cap.read()
if not ret :
break
all_frames.append(frame)
cap.release()
cv2.destroyAllWindows()
cv2.VideoCapture() Usage and examples
cv2.waitKey() and cv2.destroyAllWindows()
边栏推荐
- leetcode-1. Sum of two numbers
- DataGridView上移 下移行
- C MDI open subform to remove automatically generated menu bar
- 如何在IDEA中自定义模板、快速生成完整的代码?
- Initial i/o and its basic operations
- MySQL基础3
- 固定资产管理系统多少钱,固定资产管理系统价格
- Top performance version 2 reading notes (IV) -- memory monitoring
- Byte, word, doubleword relationship
- Sofaregistry source code | data synchronization module analysis
猜你喜欢

2022年最新最详细IDEA关联数据库方式、在IDEA中进行数据库的可视化操作(包含图解过程)

俞敏洪:我的退与进;架构师必须了解的5种最佳软件架构模式;Redis夺命52连问|码农周刊VIP会员专属邮件周报 Vol.096

Time does not spare

云呐|固定资产系统管理,nc系统管理固定资产在哪里

Traffic, but no sales? 6 steps to increase website sales

Statistical query of SQL Server database

Briefly: how are fragments communicated?

Le module twincat 3 el7211 contrôle les servocommandes baffle

The third bullet of wechat payment app application for refund

面试官:为什么数据库连接很消耗资源?我竟然答不上来。。一下懵了!
随机推荐
云呐|固定资产信息系统管理,信息化固定资产管理
Use of shortcut keys for idea tools
月薪没到30K的程序员必须要背的面试八股,我先啃为敬!
SOFARegistry 源码|数据同步模块解析
[PHP] PHP pressure test, error reporting: generally, each socket address (Protocol / network address / port) is only allowed to be used
如何做好测试用例设计
俞敏洪:我的退与进;架构师必须了解的5种最佳软件架构模式;Redis夺命52连问|码农周刊VIP会员专属邮件周报 Vol.096
MySQL基础篇1
modbus-tcp-rtu协议图表
Interviewer: why does database connection consume resources? I can't even answer.. I was stunned!
SQL Server database addition, deletion, modification and query statements
科创人·味多美CIO胡博:数字化是不流血的革命,正确答案藏在业务的田间地头
有流量,但没有销售?增加网站销量的 6 个步骤
股票网上开户及开户流程怎样?还有,在线开户安全么?
中小企业签署ERP合同时,需要注意这几点
玉米地里的小鸟
Which securities company is better and which platform is safer for stock speculation account opening
Sword finger offer II 035 Minimum time difference
Lower expectations
Sofaregistry source code | data synchronization module analysis