前段时间练习过的一个小项目,今天再看看,记录一下~
项目结构
说明:
- datefile文件夹:保存车辆信息表的xlsx文件
- file文件夹:保存图片文件夹。ic_launcher.jpg是窗体的右上角图标文件;income.png是实现收入统计的柱状图(下一篇文章实现);key.txt是使用百度的图片识别AI接口申请的key;test.jpg保存的是摄像头抓取的图片
- venv文件夹:项目所需要的各种模块,即项目运行环境
- btn.py文件:按钮模块
- main.py文件:程序主文件
- ocrutil.py文件:车牌识别模块
- timeutil.py文件:时间处理模块
主要代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# 车位文字 def text1(screen): # 剩余车位 k = Total - carn if k < 10 : # 剩余车位 sk = '0' + str (k) else : sk = str (k) # 使用系统字体 xtfont = pygame.font.SysFont( 'SimHei' , 20 ) # 重新开始按钮 textstart = xtfont.render( '共有车位:' + str (Total) + ' 剩余车位:' + sk, True , WHITE) # 获取文字图像位置 text_rect = textstart.get_rect() # 设置文字图像中心点 text_rect.centerx = 820 text_rect.centery = 30 # 绘制内容 screen.blit(textstart, text_rect) # 停车场信息表头 def text2(screen): # 使用系统字体 xtfont = pygame.font.SysFont( 'SimHei' , 15 ) # 重新开始按钮 textstart = xtfont.render( ' 车号 时间 ' , True , WHITE) # 获取文字图像位置 text_rect = textstart.get_rect() # 设置文字图像中心点 text_rect.centerx = 820 text_rect.centery = 70 # 绘制内容 screen.blit(textstart, text_rect) pass # 停车场车辆信息 def text3(screen): # 使用系统字体 xtfont = pygame.font.SysFont( 'SimHei' , 12 ) # 获取文档表信息 cars = pi_table[[ 'carnumber' , 'date' , 'state' ]].values # 页面就绘制10辆车信息 if len (cars) > 10 : cars = pd.read_excel(path + '停车场车辆表.xlsx' , skiprows = len (cars) - 10 , sheet_name = 'data' ).values # 动态绘制y点变量 n = 0 # 循环文档信息 for car in cars: n + = 1 # 车辆车号 车辆进入时间 textstart = xtfont.render( str (car[ 0 ]) + ' ' + str (car[ 1 ]), True , WHITE) # 获取文字图像位置 text_rect = textstart.get_rect() # 设置文字图像中心点 text_rect.centerx = 820 text_rect.centery = 70 + 20 * n # 绘制内容 screen.blit(textstart, text_rect) pass |
实现效果
到此这篇关于基于Python实现智能停车场车牌识别计费系统的文章就介绍到这了,更多相关Python车牌识别计费系统内容请搜索服务器之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持服务器之家!
原文链接:https://mp.weixin.qq.com/s/tuuYsYaIz_HADyyPtYuPsg