以下均为github上opencv的个人学习笔记,原路径如下:
https://github.com/JimmyHHua/opencv_tutorials
源码示例:
import cv2 as cv
import numpy as np
capture = cv.VideoCapture("./test.avi")
# capture = cv.VideoCapture(0) 打开摄像头
height = capture.get(cv.CAP_PROP_FRAME_HEIGHT)
width = capture.get(cv.CAP_PROP_FRAME_WIDTH)
count = capture.get(cv.CAP_PROP_FRAME_COUNT)
fps = capture.get(cv.CAP_PROP_FPS)
print(height, width, count, fps)
out = cv.VideoWriter("./test.avi", cv.VideoWriter_fourcc('D', 'I', 'V', 'X'), 15,
(np.int(width), np.int(height)), True)
while True:
ret, frame = capture.read()
if ret is True:
cv.imshow("video-input", frame)
out.write(frame)
c = cv.waitKey(50)
if c == 27: # ESC
&nbs

本文是关于OpenCV的视频读写操作的学习笔记,介绍了如何使用VideoCapture类进行视频读取,包括从文件和摄像机读取,以及VideoCapture的相关函数。同时,文章讨论了VideoWriter类在视频写操作中的应用,并提到了OpenCV对MP4格式的支持问题及解决方案。
最低0.47元/天 解锁文章
329

被折叠的 条评论
为什么被折叠?



