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

MATLAB霍夫曼表盘识别系统

MATLAB霍夫曼表盘识别系统

一、介绍

本设计为基于MATLAB的表盘指针识别,算法原理是基于hough变换。可检测压力表,石英手表,电表刻度,气压表等带指针刻度的表盘。通过hough检测直线和圆的关系,得出指针夹角,根据刻度换算关系得出具体刻度值。算法流程为:原图,灰度变换,二值化,hough变换,刻度指针处刻度定位,计算夹角,得出示数。本设计带有一个人机交互GUI界面,操作人性化,逻辑清晰。

二、运行图

三、核心代码

RGB=imread('14.jpg');
figure,imshow(RGB);     title('RGB')
GRAY=rgb2gray(RGB);
figure,imshow(GRAY);    title('GRAY')
threshold=graythresh(GRAY);
BW=im2bw(GRAY,threshold);
figure,imshow(BW);      title('BW')
BW=~BW;
figure,imshow(BW);      title('~BW')
BW=bwmorph(BW,'thin',Inf);
figure,imshow(BW);      title('BWMORPH')
[M,N]=size(BW);
[H,T,R] = hough(BW);
figure;
imshow(H,[],'XData',T,'YData',R,'InitialMagnification','fit');xlabel('\theta'), ylabel('\rho');axis on, axis normal, hold on;P  = houghpeaks(H,1,'threshold',ceil(0.3*max(H(:))));x = T(P(:,2));y = R(P(:,1));plot(x,y,'s','color','white');
%%%%%%%%%%%%%%%%%%%% Find lines and plot them%%%%%%%%%%%%%%for k = 1:length(lines)xy = [lines(k).point1; lines(k).point2];plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green');
%%%%%%%%%% plot beginnings and ends of lines%%%%%%%%%%%%%%%%%%plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow'); plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red');
%%%% determine the endpoints of the longest line segment %%%%len = norm(lines(k).point1 - lines(k).point2);if ( len > max_len)max_len = len;xy_long = xy;endend
%%%%%%%%%%%%% highlight the longest line segment%%%%%%%%%%%%%%plot(xy_long(:,1),xy_long(:,2),'LineWidth',2,'Color','cyan');k=(xy(2,2)-xy(1,2))/(xy(2,1)-xy(1,1));theta=pi/2+atan(k);if((xy(1,1)+xy(2,1))/2<=N/2)q=(theta+pi)*180/3.14;        elseq=theta*180/3.14;            endshishu=q*6/2700-0.2;disp (theta);disp (q);disp (shishu);

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

相关文章:

  • Python | Leetcode Python题解之第322题零钱兑换
  • python中类class的魔法方法
  • 计算机体系结构和计算机组成原理的区别
  • MySQL--数据库备份
  • influxDB的常用命令
  • 使用 1panel面板 部署 springboot 和 vue
  • 快速体验LLaMA-Factory 私有化部署和高效微调Llama3模型(曙光超算互联网平台异构加速卡DCU)
  • Cocos Creator 3.8.x bundle设置最佳方案
  • 【论文笔记】4D Millimeter-Wave Radar in Autonomous Driving: A Survey
  • 搭建 Rancher 服务,配置k8s集群
  • 数据恢复的定制之旅:打造SQL Server的专属恢复方案
  • Javascript常见算法详解
  • MySQL数据管理 - 查询语句
  • 经典图论算法回顾之Bellman-Ford算法
  • LinuxC++(10):调用可执行程序
  • C语言指针·高级用法超详解(指针运算、野指针、悬空指针、void类型指针、二级以及多级指针)
  • SQL注入:MySQL元数据库,外网实战手工SQL注入
  • 接口与抽象类有什么区别
  • 【时时三省】unity test 测试框架 使用 code blocks 移植(核心文件:unity.c, unity_fixture.c)
  • 安装Docker以及安装过程中的错误解决
  • PXE实验
  • Spring - 解析 统一数据格式返回以及统一异常处理
  • 用Manim实现——计算和绘制图形下方区域
  • MySQL 保姆级教程(十五): 组合查询
  • 《动手做科研》06. 如何产生新的研究想法
  • 【Kubernetes】Deployment 的状态
  • 新手学习Gazebo+ros仿真控制小车-----易错和自己理解
  • jdbc(mysql)
  • 【Linux】搜索log在哪个文件中执行的方法
  • web小游戏开发:2048(完)移动操作及动画效果