首页 > 其他分享 >opencv修改帧数

opencv修改帧数

时间:2023-01-05 18:34:12浏览次数:35  
标签:vc 修改 frame cv2 break opencv open

#opencv读取视频文件
import cv2
import matplotlib.pyplot as plt
vc=cv2.VideoCapture('test.mp4')
#检测视频打开是否正确
if vc.isOpened():
    oepn,frame=vc.read()
else:
    open=False
while open:
    ret,frame=vc.read()
    if frame is None:
        break#读完之后break
    if ret==True:
        gray=cv2.cvtColor(frame,cv2.COLOR_RGB2GRAY)#转成灰色帧
        cv2.imshow('reslut',gray)
        if cv2.waitKey(100)& 0xFF==27:
            break
vc.release()
cv2.destroyAllWindows()

标签:vc,修改,frame,cv2,break,opencv,open
From: https://www.cnblogs.com/tgfoven/p/17028579.html

相关文章