ITPub博客

首页 > IT职业 > IT生活 > 基于matlab的车牌识别(含子程序)

基于matlab的车牌识别(含子程序)

IT生活 作者:专注的阿熊 时间:2022-12-29 16:28:19 0 删除 编辑

d=qiege(d);

[m,n]=size(d);

   % subplot(3,2,5),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<y1  跟单网gendan5.com % 认为是左侧干扰

         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;   

         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);

figure(9);

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

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

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

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

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

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

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

[m,n]=size(word1);

% 商用系统程序中归一化大小为 40*20, 此处演示

word1=imresize(word1,[40 20]);

word2=imresize(word2,[40 20]);

word3=imresize(word3,[40 20]);

word4=imresize(word4,[40 20]);

word5=imresize(word5,[40 20]);

word6=imresize(word6,[40 20]);

word7=imresize(word7,[40 20]);

subplot(2,7,8),imshow(word1),title('1');

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

subplot(2,7,10),imshow(word3),title('3');

subplot(2,7,11),imshow(word4),title('4');

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

subplot(2,7,13),imshow(word6),title('6');

subplot(2,7,14),imshow(word7),title('7');

imwrite(word1,'1.jpg');

imwrite(word2,'2.jpg');

imwrite(word3,'3.jpg');

imwrite(word4,'4.jpg');

imwrite(word5,'5.jpg');

imwrite(word6,'6.jpg');

imwrite(word7,'7.jpg'); 运行结果如下:


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69946337/viewspace-2930068/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-08-23

  • 博文量
    410
  • 访问量
    276749