【文章內容簡介】
m2bw(I1,T/256)。 subplot(3,2,4)。 imshow(I1),title(39。二值化車牌圖像 39。)。 I2=bwareaopen(I1,20)。 subplot(3,2,5)。 imshow(I2),title(39。形態(tài)學 濾波后的二值化圖像 39。)。 [y1,x1,z1]=size(I2)。 I3=double(I2)。 TT=1。 %%%%%%%去除圖像頂端和底端的不感興趣區(qū)域 %%%%% 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)amp。amp。(Py0y1)) Py0=Py0+1。 end Py1=Py0。 while((Y1(Py1,1)=20)amp。amp。(Py1y1)) Py1=Py1+1。 end I2=I2(Py0:Py1,:,:)。 subplot(3,2,6)。 imshow(I2),title(39。目標車牌區(qū)域 39。)。 %%%%%% 分割字符按行積累量 %%%%%%% X1=zeros(1,x1)。 for j=1:x1 for i=1:y1 if(I3(i,j,1)==1) X1(1,j)= X1(1,j)+1。 end end end figure(5)。 plot(0:x11,X1),title(39。列方向像素點灰度值累計和 39。),xlabel(39。列值 39。),ylabel(39。累計像素量 39。)。 Px0=1。 Px1=1。 %%%%%%%%%%%%分割字符 %%%%%%%%%%%%%%%%%% for i=1:7 while ((X1(1,Px0)3)amp。amp。(Px0x1)) Px0=Px0+1。 end Px1=Px0。 while (((X1(1,Px1)=3)amp。amp。(Px1x1))||((Px1Px0)10)) Px1=Px1+1。 end Z=I2(:,Px0:Px1,:)。 switch strcat(39。Z39。,num2str(i)) case 39。Z139。 PIN0=Z。 case 39。Z239。 PIN1=Z。 case 39。Z339。 PIN2=Z。 case 39。Z439。 PIN3=Z。 case 39。Z539。 PIN4=Z。 case 39。Z639。 PIN5=Z。 otherwise PIN6=Z。 end figure(3)。 subplot(1,7,i)。 imshow(Z)。 Px0=Px1。 End 車牌字符識別 字符識別方法主要有基于模板匹配算法和基