Video to Image by Using Opencv2 in Python

 


Code


import cv2

vidCap=cv2.VideoCapture("vid.mp4");


success,frame=vidCap.read()

i=0

while success:

    cv2.imshow("vid",frame)

    cv2.imwrite("image%d.png"%i,frame)


    success,frame=vidCap.read()

    i+=1


    if cv2.waitKey(1) & 0xFF==ord('q'):

        break;


Comments

Popular posts from this blog

How to make simple bill maker by using python tkinter

Make a GST Calculator using HTML and JavaScript

Write a program to find the sum of 1/2+4/3+5/6+8/7+9/10 using loop in java