✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
对交通灯的识别主要基于对交通灯的色彩及形状特征.基于信号灯的亮度对其进行分割,提取,并设置了一种自动最优选择阈值的方法.再由HIS彩色空间的H信息识别颜色.最后根据二值化的交通灯的横坐标和纵坐标方向的投影进行形状匹配识别.
⛄ 部分代码
function [] = Red(X)
%RED Summary of this function goes here
% Detailed explanation goes here
[row,col]=size(X);
x=floor(row/10);
y=floor(col/12);
SE=[1 1 1;1 1 1;1 1 1];
X=imerode(X,SE);
found =false;
%G=imopen(G,SE);
[centers,radii] = imfindcircles(X,[15 100],'ObjectPolarity','bright','Sensitivity',.95);
%centers
%radii
imshow(X)
plot=subplot(224);
title(plot,'红灯')
h = viscircles(centers,radii);
c=0;
[a,b]=size(radii);
for x = 1:a
rr=floor(centers(x,1));
cc=floor(centers(x,2));
radii=floor(radii);
for i=cc-radii:cc+radii
for j=rr-radii:rr+radii
if X(i,j)==255
c=c+1;
end
end
end
c;
d=floor(3.1416*radii(x)*radii(x));
if (c<d*1.25 || d<c*1.25 )&& found==false
found=true;
disp('Red Color Detected')
else
% disp('Red Not Detected')
end
end
end
⛄ 运行结果
⛄ 参考文献
[1] 李佳阳, 刘奇. 基于MATLAB的交通信号灯识别方法[J]. 甘肃科技, 2016, 32(23):4.
[2] 张玉宝, 赵玮. 基于Matlab图像识别的交通信号灯智能控制[J]. 工业, 2015, 000(025):P.140-140.
[3] 朱玥凝. 基于Matlab图像识别的交通信号灯智能控制[J]. 信息通信, 2016(11):2.
[4] 桂欣悦, 李振伟, 吴晨晨,等. 基于MATLAB的红绿灯识别系统研究[J]. 电子设计工程, 2020, 28(16):4.