Python实现同步笔记系统(一)
import cv2
import numpy
videoCapture = cv2.VideoCapture('D:/videofile/video2.mp4')
num=0
total = int(videoCapture.get(cv2.CAP_PROP_FRAME_COUNT))
print("[INFO] {} total frames in video".format(total))
while(1):
ret, img = videoCapture.read()
if not ret:
break
cv2.imwrite('D:/videofile/pic2_'+ str(num) + ".jpg", img)
if num==total:
break
num=num+1
fps=videoCapture.get(cv2.CAP_PROP_FPS)
size = (int(videoCapture.get(cv2.CAP_PROP_FRAME_WIDTH)),
int(videoCapture.get(cv2.CAP_PROP_FRAME_HEIGHT)))
print("fps: {}\nsize: {}".format(fps,size))
import tkinter as tk
import cv2
window = tk.Tk()
window.title("button")
window.geometry("800x480")
num=0
total=222
def player():
global num
img = cv2.imread('D:/videofile/pic2_'+str(num)+".jpg",1)
cv2.imshow("showing",img)
num+=1
tk.Button(window,width=20,height=2,text='播放',command=player).pack()
window.mainloop()