码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • Python电梯楼层数字识别


    程序示例精选
    Python电梯楼层数字识别
    如需安装运行环境或远程调试,见文章底部个人QQ名片,由专业技术人员远程协助!

    前言

    这篇博客针对《Python电梯楼层数字识别》编写代码,代码整洁,规则,易读。 学习与应用推荐首选。


    运行结果

    在这里插入图片描述


    文章目录

    一、所需工具软件
    二、使用步骤
           1. 主要代码
           2. 运行结果
    三、在线协助

    一、所需工具软件

           1. Python
           2. Pycharm

    二、使用步骤

    代码如下(示例):
    
    import cv2
    import numpy as np
    import os
    
    # 读取test中的图片
    img1 = cv2.imread('test/3.jpg')
    # 定义FLANN匹配器参数
    indexParams = dict(algorithm=0, trees=10)
    searchParams = dict(checks=50)
    # 遍历文件夹中的所有图片
    template_folder = 'template'
    for template_name in os.listdir(template_folder):
        img2_path = os.path.join(template_folder, template_name)
        img2 = cv2.imread(img2_path)
    
        # 对当前template图片获取特征点和描述符
        kp2, des2 = sift.detectAndCompute(img2, None)
        matches = sorted(matches, key=lambda x: x[0].distance)
    
        # 调整ratio,筛选好的匹配点
        good = []
        MATCH_THRESHOLD = 10
    
        # 检测匹配是否成功
        if len(good) >= MATCH_THRESHOLD:
            # 获取所有好的匹配点在img1中的位置
            src_pts = np.float32([kp1[m[0].queryIdx].pt for m in good]).reshape(-1, 1, 2)
            x, y, w, h = cv2.boundingRect(src_pts)
            cx, cy = x + w / 2, y + h / 2  # 计算中心点
            scale_factor = 2.2  # 扩大比例因子
            new_w = w * scale_factor
            new_h = h * scale_factor
            new_x = int(cx - new_w / 2)
            new_y = int(cy - new_h / 2)
            new_x2 = int(cx + new_w / 2)
            new_y2 = int(cy + new_h / 2)
            cv2.rectangle(img1, (new_x, new_y), (new_x2, new_y2), (255, 255, 0), 22)
    
            font1 = "Current number:";
            font2 = "pcs";
            font = cv2.FONT_HERSHEY_TRIPLEX  
            template_nameT=template_name.split('.')[0]
            cv2.putText(img1, font1 + str(template_nameT), (10, 118), font, 3.8, (0, 0, 255), 8)  
            cv2.imshow("DetectedPhoto1", img1)
            cv2.waitKey(0)
            cv2.destroyAllWindows()
    
        else:
            print("No photo matched to "+template_name)
    
    
    
    • 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
    运行结果

    在这里插入图片描述

    三、在线协助:

    如需安装运行环境或远程调试,见文章底部个人 QQ 名片,由专业技术人员远程协助!

    1)远程安装运行环境,代码调试
    2)Visual Studio, Qt, C++, Python编程语言入门指导
    3)界面美化
    4)软件制作
    5)云服务器申请
    6)网站制作

    当前文章连接:https://blog.csdn.net/alicema1111/article/details/132666851
    个人博客主页:https://blog.csdn.net/alicema1111?type=blog
    博主所有文章点这里:https://blog.csdn.net/alicema1111?type=blog

    博主推荐:
    Python人脸识别考勤打卡系统:
    https://blog.csdn.net/alicema1111/article/details/133434445
    Python果树水果识别:https://blog.csdn.net/alicema1111/article/details/130862842
    Python+Yolov8+Deepsort入口人流量统计:https://blog.csdn.net/alicema1111/article/details/130454430
    Python+Qt人脸识别门禁管理系统:https://blog.csdn.net/alicema1111/article/details/130353433
    Python+Qt指纹录入识别考勤系统:https://blog.csdn.net/alicema1111/article/details/129338432
    Python Yolov5火焰烟雾识别源码分享:https://blog.csdn.net/alicema1111/article/details/128420453
    Python+Yolov8路面桥梁墙体裂缝识别:https://blog.csdn.net/alicema1111/article/details/133434445

  • 相关阅读:
    一段代码让你了解Java中的抽象
    会议管理系统SSM记录(二)
    client-go实战之七:准备一个工程管理后续实战的代码
    Java 进阶(一)-- 并发
    目录自动清洗
    【23真题】易!题源全部定位!带讲解!
    手把手教学!新一代 Kaldi: TTS Runtime ASR 实时本地语音识别 语音合成来啦
    开源组件漏洞检测工具之 ide 插件 by 大龙
    PX4飞行测试
    【Linux】死锁理解
  • 原文地址:https://blog.csdn.net/alicema1111/article/details/136733964
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号