代码拉取完成,页面将自动刷新
import cv2
from tkinter import *
from picture import QMainWindow
from picture1 import dealpicture
from PIL import Image, ImageTk
# from baidu1 import gesture_recognition
def GUI():
# cap = cv2.VideoCapture(0)#创建摄像头对象
# #界面画布更新图像
# def tkImage():
# ref,frame=cap.read()
# frame = cv2.flip(frame, 1) #摄像头翻转
# cvimage = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA)
# pilImage=Image.fromarray(cvimage)
# pilImage = pilImage.resize((image_width, image_height),Image.ANTIALIAS)
# tkImage = ImageTk.PhotoImage(image=pilImage)
# return tkImage
root=Tk()
root.title("gesture Recognition")
root.config(background="gray")
# 获取屏幕尺寸,使窗口位于屏幕中央
width = 700
heigh = 500
screenwidth = root.winfo_screenwidth()
screenheight = root.winfo_screenheight()
root.geometry('%dx%d+%d+%d'%(width, heigh, (screenwidth-width)/2, (screenheight-heigh)/2))
# 标题
labelName = Label(root, text='实时手势识别系统',font = ('songti',30),width=30,height=3,fg="blue",background="gray")
labelName1 = Label(root, text='组员:刘名扬 陈思洲 罗杰',font = ('songti',15),background="gray")
# 功能按键
button1=Button(root,text='图像处理检测',font=('楷体',18),fg="blue",width=15,background="gainsboro",command=QMainWindow)
button2=Button(root,text='图像处理检测2',font=('楷体',18),fg="blue",width=15,background="gainsboro",command=dealpicture)
button3=Button(root,text='百度实时检测',font=('楷体',18),fg="blue",width=15,background="gainsboro")
button4=Button(root,text='Tensorflow检测',font=('楷体',18),fg="blue",width=15,background="gainsboro",)
button5=Button(root, text='退出系统', font=('楷体', 18),fg="blue",width=15,background="gainsboro",command=root.destroy)
# 位置
labelName.place(x=50, y=5)
labelName1.place(x=400, y=90)
button1.place(x=55, y=120)
button2.place(x=55, y=170)
button3.place(x=55, y=220)
button4.place(x=55, y=270)
button5.place(x=55, y=320)
# image_width = 300
# image_height = 200
# canvas = Canvas(root,bg = 'white',width = image_width,height = image_height )#绘制画布
# canvas.place(x = 150,y = 250)
# while True:
# ref, frame = cap.read()
# frame = cv2.flip(frame, 1) # 摄像头翻转
# cvimage = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA)
# pilImage = Image.fromarray(cvimage)
# pilImage = pilImage.resize((image_width, image_height), Image.ANTIALIAS)
# tkImage = ImageTk.PhotoImage(image=pilImage)
#
# canvas.create_image(0,0,anchor = 'nw',image = tkImage)
# root.update()
# root.after(1)
numIdx = 30 # gif的帧数
# 填充6帧内容到frames
frames = [PhotoImage(file='D:/QQ罗杰/4.gif', format='gif -index %i' % i) for i in range(numIdx)]
def update(idx): # 定时器函数
frame = frames[idx]
idx += 1 # 下一帧的序号:在0,1,2,3,4,5之间循环(共6帧)
label.configure(image=frame) # 显示当前帧的图片
root.after(100, update, idx % numIdx) # 0.1秒(100毫秒)之后继续执行定时器函数(update)
label = Label(root)
label.place(x=250, y=120, width=430, height=270)
root.after(0, update, 0) # 立即启动定时器函数(update)
root.mainloop()
if __name__ == '__main__':
GUI()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。