Python实现同步笔记系统(一)

Python实现同步笔记系统(一)

import cv2
import numpy
#image = cv2.imread(r"C:\Users\lenovo\Desktop\Postgra\photos\p1.png") 
#cv2.imshow("Image",image) 
#cv2.waitKey(0)
#cv2.destroyAllWindows()
#
#img = numpy.zeros((3,3),dtype=numpy.uint8)
#img=cv2.cvtColor(img,cv2.COLOR_GRAY2BGR)

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):
    # get a frame
    ret, img = videoCapture.read()
    # show a frame
#    cv2.imshow("capture", frame)
#    if cv2.waitKey(100) & 0xFF == ord('q'):
#        break
    if not ret:
        break
    cv2.imwrite('D:/videofile/pic2_'+ str(num) + ".jpg", img)  #写出视频图片.jpg格式
    if num==total:                                  #导出视频的前12帧图像  
        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)
    	#当按键按下时,打印‘hello’
    cv2.imshow("showing",img)
    num+=1

tk.Button(window,width=20,height=2,text='播放',command=player).pack()
window.mainloop()
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值