from cv2 import cv2 as cv
import numpy as np
def video_demo(): #读取视频
capture = cv.VideoCapture(0) # 读摄像头,也可以读一些文件 0 指的是usb摄像头,读取其他视频可参考opencv2.py
while True:
ret,frame = capture.read()
frame = cv.flip(frame,1)
cv.imshow("video",frame)
c = cv.waitKey(50)
if c == 27:
break
def videoFIle_demo(): #读取文件的视频
capture = cv.VideoCapture('C:\\BaiduNetdiskDownload\\053.mp4') # 读摄像头,也可以读一些文件
capture.read()
while True:
ret,frame = capture.read()
#frame = cv.flip(frame,1)
cv.imshow("video",frame)
c = cv.waitKey(50)
if c == 27:
break
#cv.imshow("input image",img)
video_demo()
cv.destroyAllWindows()
python + opencv 图像处理(二)——读取视频
最新推荐文章于 2024-10-04 10:17:31 发布
675

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



