matlab 车牌号码识别程序代码

内容发布更新时间 : 2025/7/27 13:56:26星期一 下面是文章的全部内容请认真阅读。

while ((Y1(PY2,1)>=50)&&(PY2

IY=I(PY1:PY2,:,:); X1=zeros(1,x); for j=1:x

for i=PY1:PY2 if(I6(i,j,1)==1)

X1(1,j)= X1(1,j)+1; end end end

subplot(3,2,2),plot(0:x-1,X1),title('列方向像素点灰度值累计和'),xlabel('列值'),ylabel('像数');

%%%%%%%求的车牌的列起始位置和终止位置%%%%%%%%% PX1=1;

while ((X1(1,PX1)<3)&&(PX1

while ((X1(1,PX2)<3)&&(PX2>PX1)) PX2=PX2-1; end PX1=PX1-1; PX2=PX2+1; %分割出车牌图像% dw=I(PY1:PY2,PX1:PX2,:);

subplot(3,2,3),imshow(dw),title('定位剪切后的彩色车牌图像')

% 4.2 车牌字符分割

% 确定车牌位置后下一步的任务就是进行字符切分分离出车牌号码的全部字符图像。

if isrgb(dw)

I1 = rgb2gray(dw); %将RGB图像转化为灰度图像 else I1=dw; end

g_max=double(max(max(I1))); g_min=double(min(min(I1)));

T=round(g_max-(g_max-g_min)/3); % T 为二值化的阈值 [m,n]=size(I1);% d:二值图像 %h=graythresh(I1); I1=im2bw(I1,T/256); subplot(3,2,4);

imshow(I1),title('二值化车牌图像');

I2=bwareaopen(I1,20); subplot(3,2,5);

imshow(I2),title('形态学滤波后的二值化图像');

[y1,x1,z1]=size(I2); I3=double(I2); TT=1;

%%%%%%%去除图像顶端和底端的不感兴趣区域%%%%% Y1=zeros(y1,1); for i=1:y1 for j=1:x1

if(I3(i,j,1)==1) Y1(i,1)= Y1(i,1)+1 ; end end end Py1=1; Py0=1;

while ((Y1(Py0,1)<20)&&(Py0

while((Y1(Py1,1)>=20)&&(Py1

I2=I2(Py0:Py1,:,:); subplot(3,2,6);

imshow(I2),title('目标车牌区域');

>>展开全文<<
12@gma联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4 ceshi