美文网首页
使用opencv对视频进行抽帧操作

使用opencv对视频进行抽帧操作

作者: ifqu | 来源:发表于2018-06-13 10:10 被阅读0次
    import cv2
    def get_video_pic(name):
        cap = cv2.VideoCapture(name)
        time=cap.get(7)
        for i in range(0,int(time)):
                cap.set(1, int(i))
                print(cap.read())
                rval, frame = cap.read()
                if rval:
                    cv2.imwrite('D:/kaobei/HyperLPR-master/HyperLPR-master/result'+str(i)+'.jpg', frame)#图片的路径
         cap.release()
    
    get_video_pic("C:/Users/Lab/Desktop/4541.mp4")#视频的路径
    
    
    

    相关文章

      网友评论

          本文标题:使用opencv对视频进行抽帧操作

          本文链接:https://www.haomeiwen.com/subject/qnadeftx.html