当前位置:网站首页>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()
边栏推荐
- 外包干了三年,废的一踏糊涂...
- 出门在外保护好自己
- Some thoughts on life
- A Yu's Rainbow Bridge
- leetcode 416. Partition equal subset sum partition equal subset sum (medium)
- Store log files in RAM to reduce physical storage loss
- 博途V16 更改PLC的型号和固件版本
- 学位论文的引用
- Small and medium-sized enterprises should pay attention to these points when signing ERP contracts
- Time does not spare
猜你喜欢

Outsourcing for 3 years is a waste

Initial i/o and its basic operations

传统微服务框架如何无缝过渡到服务网格 ASM

云呐|如何利用系统管理固定资产?如何进行固定资产管理?

Connection query of SQL Server database

间歇采样转发干扰

面试官:大量请求 Redis 不存在的数据,从而影响数据库,该如何解决?

MySQL advanced 2
![[daily question 1] traversal of binary tree](/img/e2/313251d574f47708abca308c4c8d5d.png)
[daily question 1] traversal of binary tree

How much is the fixed asset management system and the price of the fixed asset management system
随机推荐
MySQL Foundation 2
Intermittent sampling and forwarding interference
微信支付 APP端 第三弹 申请退款
MySQL basics 1
Modbus TCP RTU protocol chart
传统微服务框架如何无缝过渡到服务网格 ASM
Time does not spare
2022年最新最详细IDEA关联数据库方式、在IDEA中进行数据库的可视化操作(包含图解过程)
Sword finger offer II 035 Minimum time difference
C MDI open subform to remove automatically generated menu bar
ML:置信区间的简介(精密度/准确度/精确度的三者区别及其关系)、使用方法、案例应用之详细攻略
SOFARegistry 源码|数据同步模块解析
The SQL statement concat cannot find the result
单位固定资产怎么管理,行政单位的固定资产应该怎么管理
Which direction of network development is better? Data communication engineer learning path sharing
IDEA中的常用设置
数据库学习笔记(SQL03)
mysql 死锁
Yunna | advantages of fixed assets system management, what are the characteristics of fixed assets management system
Time flies that year