停车场车牌识别计费系统,用Python如何实现?

关注+星标,每天学习Python新技能

前段时间练习过的一个小项目,今天再看看,记录一下~

项目结构

说明:

  • datefile文件夹:保存车辆信息表的xlsx文件

  • file文件夹:保存图片文件夹。ic_launcher.jpg是窗体的右上角图标文件;income.png是实现收入统计的柱状图;key.txt是使用百度的图片识别AI接口申请的key;test.jpg保存的是摄像头抓取的图片

  • venv文件夹:项目所需要的各种模块,即项目运行环境

  • btn.py文件:按钮模块

  • main.py文件:程序主文件

  • ocrutil.py文件:车牌识别模块

  • timeutil.py文件:时间处理模块

主要代码

复制代码
# 车位文字  
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  

实现效果

相关推荐
花酒锄作田4 小时前
使用 pkgutil 实现动态插件系统
python
前端付豪8 小时前
LangChain链 写一篇完美推文?用SequencialChain链接不同的组件
人工智能·python·langchain
曲幽8 小时前
FastAPI实战:打造本地文生图接口,ollama+diffusers让AI绘画更听话
python·fastapi·web·cors·diffusers·lcm·ollama·dreamshaper8·txt2img
老赵全栈实战9 小时前
Pydantic配置管理最佳实践(一)
python
阿尔的代码屋15 小时前
[大模型实战 07] 基于 LlamaIndex ReAct 框架手搓全自动博客监控 Agent
人工智能·python
AI探索者1 天前
LangGraph StateGraph 实战:状态机聊天机器人构建指南
python
AI探索者1 天前
LangGraph 入门:构建带记忆功能的天气查询 Agent
python
FishCoderh1 天前
Python自动化办公实战:批量重命名文件,告别手动操作
python
躺平大鹅1 天前
Python函数入门详解(定义+调用+参数)
python
曲幽1 天前
我用FastAPI接ollama大模型,差点被asyncio整崩溃(附对话窗口实战)
python·fastapi·web·async·httpx·asyncio·ollama