当前位置: 首页 > news >正文

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_factornew_h = h * scale_factornew_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)
运行结果

在这里插入图片描述

三、在线协助:

如需安装运行环境或远程调试,见文章底部个人 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

http://www.lryc.cn/news/319791.html

相关文章:

  • Linux学习:基础开发工具的使用(1)
  • 在idea中配置tomcat服务器,然后部署一个项日
  • C语言例:设 int a=11; 则表达式 a+=a-=a*a 的值
  • C++ 中的虚函数和多态性
  • 叶顺舟:手机SoC音频趋势洞察与端侧AI技术探讨 | 演讲嘉宾公布
  • SpringBoot之yml与properties配置文件格式的区别
  • 【递归搜索回溯专栏】专题二:二叉树中的深搜----二叉树剪枝
  • Django实现登录注册
  • Python实战:NumPy数组与矩阵操作入门
  • 2024.2.26校招 实习 内推 面经
  • cannot find -xml2: No such file or directory的解决方法
  • linux下的进程间通信
  • 基于单片机的IC 卡门禁系统设计
  • 【爬虫介绍】了解爬虫的魅力
  • Xcode 15.3 Archive失败
  • Hadoop学习3:问题解决
  • HarmonyOS鸿蒙开发常用4种布局详细说明
  • Python中的变量是什么类型?
  • 数据结构之顺序表(C语言版)
  • Java学习笔记(15)
  • js中怎样添加、移出、插入、复制、创建?
  • 浅谈C/C++的常量const、指针和引用问题
  • React三大属性---state,props,ref
  • 进程学习--02
  • 简易版 RPC 框架实现 1.0 -http实现
  • 欧科云链做客Google Cloud与WhalerDAO专题论坛,畅谈Web3数据机遇
  • 计算机网络 TCP协议的流量控制
  • 【基于HTML5的网页设计及应用】——改变文字和背景颜色
  • 面向对象编程第三式: 多态 (Java篇)
  • [数据集][目标检测]草莓成熟度检测数据集VOC+YOLO格式412张3类别