How to get image from video using opencv python

后端 未结 2 1182
独厮守ぢ
独厮守ぢ 2021-02-14 09:12

I want to get image from video and store it in \'.jpeg\' or \'.png\' format please help me how to do this with opencv My code is

2条回答
  •  一向
    一向 (楼主)
    2021-02-14 10:09

    This is my code for get image from video with opencv

    import cv2
    print(cv2.__version__)
    vidcap = cv2.VideoCapture("Malar.mp4")
    print vidcap.read()
    success,image = vidcap.read()
    count = 0
    success = True
    while success:
      success,image = vidcap.read()
      print 'Read a new frame: ', success
      cv2.imwrite("frame%d.jpg" % count, image)     # save frame as JPEG file
      count += 1
    

提交回复
热议问题