screen=pygame.display.set_mode(conf.size) screen.fill(conf.BG) clock=pygame.time.Clock() try: cam=cv2.VideoCapture(0) #由于电脑只有一个摄像头,所以就出入库共用一个 #cam1=cv2.VideoCapture(1) except: print("请连接摄像头") font = pygame.font.SysFont('SimHei',18) button_in=btn.Button(screen, (190,215), 100, 35, conf.BLUE, conf.WHITE, '入库识别', 20) button_in.draw_button() button_out=btn.Button(screen, (190,445), 100, 35, conf.BLUE, conf.WHITE, '出库识别', 20) button_out.draw_button() park_inf(screen,font) Running=True def button_click(pos): if pos[0]>90 and pos[0]<190 and pos[1]>180 and pos[1]<215: print('入库识别') return 0 if pos[0]>90 and pos[0]<190 and pos[1]>410 and pos[1]<445: print('出库识别')
clock = pygame.time.Clock() """button""" # 定义颜色 BLACK = (0, 0, 0) WHITE = (255, 255, 255) GREEN = (0, 255, 0) BLUE = (72, 61, 139) GRAY = (96, 96, 96) RED = (220, 20, 60) YELLOW = (255, 255, 0) # 主线程 Running = True while Running: # 创建识别按钮 button_go = btn.Button(screen, (640, 480), 150, 60, BLUE, WHITE, "识别", 25) # 绘制创建的按钮 button_go.draw_button() device() create_save_file() # print(os.getcwd()+'/datafile/') for event in pygame.event.get(): # 关闭页面游戏退出 if event.type == pygame.QUIT: # 退出 pygame.quit() exit() # 识别按钮 if 492 <= event.pos[0] and event.pos[
# 设置图片大小 image = pygame.transform.scale(image, (640, 480)) # 绘制视频画面 screen.blit(image, (2, 2)) # 背景文字图案 text0(screen) # 停车位信息 text1(screen) # 停车场信息表头 text2(screen) # 停车场车辆信息 text3(screen) # 提示信息 text4(screen, txt1, txt2, txt3) # 创建识别按钮 button_go = btn.Button(screen, (640, 480), 150, 60, BLUE, WHITE, "识别", 25) # 绘制创建的按钮 button_go.draw_button() # 创建分析按钮 button_go1 = btn.Button(screen, (990, 480), 100, 40, RED, WHITE, "收入统计", 18) # 绘制创建的按钮 button_go1.draw_button() # 判断是否开启了收入统计按钮 if income_switch: # 开启时候绘制页面 text5(screen) pass else: pass for event in pygame.event.get():