【正文】
B圖像處理的汽車牌照識別,主要包括車牌定位、字符車牌分割、和車牌字符識別三個關鍵環(huán)節(jié)。實驗內容及步驟1. 圖像預處理:預處理源代碼: I=imread(39。)。 subplot(3,2,1),imshow(I), title(39。)。%轉化為灰度圖像subplot(3,2,2),imshow(I1),title(39。)。robert39。both39。%采用robert算子進行邊緣檢測subplot(3,2,3),imshow(I2),title(39。)。1。 %線型結構元素 I3=imerode(I2,se)。腐蝕后邊緣圖像39。 se=strel(39。,[25,25])。%圖像聚類、填充圖像subplot(3,2,5),imshow(I4),title(39。)。%去除聚團灰度值小于2000的部分subplot(3,2,6),imshow(I5),title(39。)。I6=double(I5)。 for i=1:y for j=1:x if(I6(i,j,1)==1) Y1(i,1)= Y1(i,1)+1。 figure()。行方向像素點灰度值累計和39。行值39。像素39。運行截圖:2. 車牌定位——車牌起始位置和終止位置PY1=MaxY。amp。 end PY2=MaxY。amp。 end IY=I(PY1:PY2,:,:)。 for j=1:x for i=PY1:PY2 if(I6(i,j,1)==1) X1(1,j)= X1(1,j)+1。列方向像素點灰度值累計和39。列值39。像數39。3. 圖片二值化代碼:if isrgb(DW) I1 = rgb2gray(DW)。 endg_max=double(max(max(I1)))。T=round(g_max(g_maxg_min)/3)。% d:二值圖像%h=graythresh(I1)。subplot(3,2,4)。二值化車牌圖像39。運行截圖:濾波二值化圖像:I2=bwareaopen(I1,20)。imshow(I2),title(39。)。I3=double(I2)。%%%%%%%去除圖像頂端和底端的不感興趣區(qū)域%%%%%Y1=zeros(y1,1)。 end end endPy1=1。while ((Y1(Py0,1)20)amp。(Py0y1)) Py0=Py0+1。 while((Y1(Py1,1)=20)amp。(Py1y1)) Py1=Py1+1。subplot(3,2,6)。目標車牌區(qū)域39。運行截圖:4. 列方向像素點灰度值累計代碼:X1=zeros(1,x1)。 end end endfigure(5)。列方向像素點灰度值累計和39。列值39。累計像素量39。運行截圖:5. 字符分割:Px0=1。figure()。amp。 end Px1=Px0。amp。 end Z=I2(:,Px0:Px1,:)。Z39。Z139。 case 39。 PIN1=Z。Z339。 case 39。 P