【钟表识别】基于计算机视觉实现钟表时间识别含Matlab源码
【钟表识别】基于计算机视觉实现钟表时间识别含Matlab源码
TT_Matlab
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,完整matlab代码或者程序定制加qq1575304183。
1 简介
基于计算机视觉实现钟表时间识别含Matlab源码
2 部分代码
function
[time_clock]= read(filepath)
I
=
imread(filepath);
[edges,center,maxxy,minxy]
=
edges_center(I);
[arrowslines,longest,center]
=
getarrows(I,edges,center,maxxy,minxy);
if
isempty(arrowslines)
info
=
imfinfo(filepath);
center(1)
=
info.Width/2;
center(2)
=
info.Height/2;
maxxy
=
[info.Width info.Height];
minxy
=
[0 0];
[arrowslines,longest,center]
=
getarrows(I,edges,center,maxxy,minxy);
end
finallines
=
struct(’point1’,{},’point2’,{});
if
length(arrowslines) == 1
newlongest
=
arrowslines(1);
finallines(1)
=
arrowslines(1);
finallines(2)
=
arrowslines(1);
end
max_len
=
0;
j
=
1;
if
length(arrowslines) == 3
for
i = 1 : length(arrowslines)
if
~isequal(arrowslines(i),longest)
finallines(j)
=
arrowslines(i);
len
=
norm(finallines(j).point1 - finallines(j).point2);
if
( len > max_len)
max_len
=
len;
newlongest
=
arrowslines(i);
end
j
=
j+1;
end
end
elseif
length(arrowslines) == 2
finallines
=
arrowslines;
newlongest
=
longest;
end
if
isequal(finallines(1),newlongest)
vminute
=
finallines(1).point2 - finallines(1).point1;
vhour
=
finallines(2).point2 - finallines(2).point1;
else
vhour
=
finallines(1).point2 - finallines(1).point1;
vminute
=
finallines(2).point2 - finallines(2).point1;
end
vminute
=
[vminute 0];
vhour
=
[vhour 0];
v2
=
[0 1 0];
angle1
=
atan2d(norm(cross(vminute,v2)),dot(vminute,v2));
angle2
=
atan2d(norm(cross(vhour,v2)),dot(vhour,v2));
if
vminute(1) > 0
angle1
=
360 - angle1;
end
if
vhour(1) > 0
angle2
=
360 -angle2;
end
minute
=
roundn(angle1/6,0);
hour
=
floor(angle2/30);
if
minute >= 10
time_clock
=
[num2str(hour) , ’:’, num2str(minute)];
else
time_clock
=
[num2str(hour) , ’:0’, num2str(minute)];
end
3 仿真结果
4 参考文献
[1]谢冰雪. 钟表时间显示方式的识别效率研究[J]. 科技资讯, 2013.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
5 代码下载
-
2023年血糖新标准公布,不是3.9-6.1,快来看看你的血糖正常吗? 2023-02-07
-
2023年各省最新电价一览!8省中午执行谷段电价! 2023-01-03
-
GB 55009-2021《燃气工程项目规范》(含条文说明),2022年1月1日起实施 2021-11-07
-
PPT导出高分辨率图片的四种方法 2022-09-22
-
2023年最新!国家电网27家省级电力公司负责人大盘点 2023-03-14
-
全国消防救援总队主官及简历(2023.2) 2023-02-10
-
盘点 l 中国石油大庆油田现任领导班子 2023-02-28
-
我们的前辈!历届全国工程勘察设计大师完整名单! 2022-11-18
-
关于某送变电公司“4·22”人身死亡事故的快报 2022-04-26
