车matlab牌字符分割,用matlab编程实现车牌字符的分割

%车牌识别主程序

I1=imread('5.jpg');

%imshow(I1);

%I1=getplate(I);%提取车牌

I2=binaryzation4(I1);%车牌二值化

%I3=rotate(I2);

%figure,subplot(211),imshow(I1),title('定位剪切彩色车牌');

%subplot(212),imshow(I3),title('Random矫正车牌');

I3=whitebackground(I2);%背景色统一成黑底白字

I4=bwareaopen(I3,10);%形态学滤波

%figure,subplot(311),imshow(I3),title('背景色统一成黑底白字二值车牌');

%subplot(312),imshow(I4),title('中值滤波后二值车牌');

I5=remove_border1(I4);%车牌去上下边框

%subplot(313),imshow(I5),title('去边框车牌');

%I5=filtering(I4);

%figure,imshow(I5),title('车牌滤波膨胀腐蚀');

% 寻找连续有文字的块,若长度大于某阈值,则认为该块有两个字符组成,需要分割

d=qiege(I5);

[m,n]=size(d);

figure;subplot(2,1,1);imshow(d);title(n);

k1=1;k2=1;s=sum(d);j=1;

while j~=n

while s(j)==0

j=j+1;

end

k1=j;

while s(j)~=0 && j<=n-1

j=j+1;

end

k2=j-1;

if k2-k1>=round(n/6.5)

[val,num]=min(sum(d(:,[k1+5:k2-5])));

d(:,k1+num+5)=0; % 分割

end

end

% 再切割

d=qiege(d);

% 切割出 7 个字符

y1=10;y2=0.25;flag=0;word1=[];

while flag==0

[m,n]=size(d);

left=1;wide=0;

while sum(d(:,wide+1))~=0

wide=wide+1;

end

if wide

d(:,[1:wide])=0;

d=qiege(d);

else

temp=qiege(imcrop(d,[1 1 wide m]));

[m,n]=size(temp);

all=sum(sum(temp));

two_thirds=sum(sum(temp([round(m/3):2*round(m/3)],:)));

if two_thirds/all>y2

flag=1;word1=temp; % WORD 1

end

d(:,[1:wide])=0;d=qiege(d);

end

end;

% 分割出第二个字符

[word2,d]=getword(d);

% 分割出第三个字符

[word3,d]=getword(d);

% 分割出第四个字符

[word4,d]=getword(d);

% 分割出第五个字符

[word5,d]=getword(d);

% 分割出第六个字符

[word6,d]=getword(d);

% 分割出第七个字符

[word7,d]=getword(d);

[word8,d]=getword(d);

subplot(5,7,1),imshow(word1),title('1');

subplot(5,7,2),imshow(word2),title('2');

subplot(5,7,3),imshow(word3),title('3');

subplot(5,7,4),imshow(word4),title('4');

subplot(5,7,5),imshow(word5),title('5');

subplot(5,7,6),imshow(word6),title('6');

subplot(5,7,7),imshow(word7),title('7');

subplot(5,7,8),imshow(word8),title('8');

%字符图像大小归一化

% 商用系统程序中归一化大小为 32*16

word1=imresize(word1,[32 16]);

word2=wordprocess(word2);

word3=wordprocess(word3);

word4=wordprocess(word4);

word5=wordprocess(word5);

word6=wordprocess(word6);

word7=wordprocess(word7);

word8=wordprocess(word8);

subplot(5,7,15),imshow(word1),title('1');

subplot(5,7,16),imshow(word2),title('2');

subplot(5,7,17),imshow(word3),title('3')

;

subplot(5,7,18),imshow(word4),title('4');

subplot(5,7,19),imshow(word5),title('5');

subplot(5,7,20),imshow(word6),title('6');

subplot(5,7,

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值