基于matlab車(chē)牌的定位與分割識(shí)別程序文件_第1頁(yè)
基于matlab車(chē)牌的定位與分割識(shí)別程序文件_第2頁(yè)
基于matlab車(chē)牌的定位與分割識(shí)別程序文件_第3頁(yè)
基于matlab車(chē)牌的定位與分割識(shí)別程序文件_第4頁(yè)
基于matlab車(chē)牌的定位與分割識(shí)別程序文件_第5頁(yè)
已閱讀5頁(yè),還剩13頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、專(zhuān)業(yè)資料基于Matlab的車(chē)牌定位與分割經(jīng)典算法匸imread(car.jpg);%讀取圖像word完美格式figure。; subplot(3,2,1),imshow(l), title(原始圖像);I仁rgb2gray(l);%轉(zhuǎn)化為灰度圖像subplot(3,2,2),imshow(I1),title(灰度圖像);灰度圖像I2=edge(I1,robert,0.09,both);%緣檢測(cè)采用robert算子進(jìn)行邊subplot(3,2,3),imshow(l2),title(邊緣檢測(cè)后圖像);邊緣檢測(cè)方se=1;1;1; %線(xiàn)型結(jié)構(gòu)元素I3=imerode(l2,se); %腐蝕圖像su

2、bplot(3,2,4),imshow(I3),title(腐蝕后邊緣圖像);se=strel(recta ngle,25,25);矩形結(jié)構(gòu)元素I4=imclose(l3,se);%圖像聚類(lèi)、填充圖像subplot(3,2,5),imshow(I4),title(填充后圖像);I5=bwareaopen(l4,2000);% 去除聚團(tuán)灰度值小于2000的部分 subplot(3,2,6),imshow(l5),title(形態(tài)濾波后圖像);形吉濾波啟y,x,z=size(l5);I6=double(I5);Y 1=zeros(y,1);for i=1:yfor j=1:xif(l6(i,j,1

3、)=1)Y 1(i,1)= Y 1(i,1)+1;endendendtemp Max Y=max( Y1);figure();subplot(3,2,1),plot(0:y-1, Y1),title(行方向像素點(diǎn)灰度值累計(jì)和),xlabel( 行值),ylabel( 像素);行債%求的車(chē)牌的行起始位置和終止位置PY 仁Max Y;while (Y 1(P Y1,1)=50)&(PY 11)PY 1=P Y1-1;endPY 2=Max Y;while (Y 1(P Y2,1)=50)&(PY 2y)PY 2=P Y2+1;endIY =I(P Y1:P Y2,:,:);X1=zeros(1,x

4、);for j=1:xfor i=P Y1:P Y2if(l6(i,j,1)=1)X1(1,j)= X1(1,j)+1;endend endsubplot(3,2,2),plot(0:x-1,X1),title(列方向像素點(diǎn)灰度值累計(jì)和),xlabel( 列值),ylabel( 像數(shù));歹U方向像素點(diǎn)挾度值累計(jì)和%求的車(chē)牌的列起始位置和終止位置PX1=1;while (X1(1,PX1)3)&(PX1x)PX1=PX1+1;endPX2=x;while (X1(1,PX2)PX1)PX2=PX2-1;endPX1=PX1 -1;PX2=PX2+1;%分割出車(chē)牌圖像% dw=l(P Y1:P Y

5、2,PX1:PX2,:);subplot(3,2,3),imshow(dw),title(定位剪切后的彩色車(chē)牌圖像)定位剪切后的彩色車(chē)牌圖傢4.2車(chē)牌字符分割確定車(chē)牌位置后下一步的任務(wù)就是進(jìn)行字符切分分離出車(chē)牌號(hào) 碼的全部字符圖像。if isrgb(I)I1 = rgb2gray(I); %將RG圖像轉(zhuǎn)化為灰度圖像else I1=l ; endg_max=double(max(max(l1);g_mi n=double(mi n(min (11);T=rou nd(g_max-(g_max-g_mi n)/3); % T為二值化的閾值m, n=size(I1);% d:二值圖像%h=grayt

6、hresh(I1);I仁im2bw(l1,T/256);subplot(3,2,4);imshow(l1),title(二值化車(chē)牌圖像);二值化車(chē)牌圖像I2=bwareaope n( 11,20);subplot(3,2,5);imshow(I2),title(形態(tài)學(xué)濾波后的二值化圖像);中值濾波后的二值化圖像y1,x1,z1=size(l2);I3=double(I2);TT=1;%除圖像頂端和底端的不感興趣區(qū)域%Y1=zeros(y1,1);for i=1:y1for j=1:x1if(l3(i,j,1)=1)Y 1(i,1)= Y 1(i,1)+1 ;endendendPy 1=1;Py

7、O=1;while (Y 1(Py0,1)20)&(PyO=20)&(Py1y1)Py1= Py1+1;endI2=I2(Py0:Py1,:,:);subplot(3,2,6);imshow(l2),title( 目標(biāo)車(chē)牌區(qū)域);目標(biāo)車(chē)牌區(qū)域%分割字符按行積累量%X1=zeros(1,x1);for j=1:x1for i=1:y1if(l3(i,j,1)=1)X1(1,j)= X1(1,j)+1;endendendfigureplot(0:x1-1,X1),title(列方向像素點(diǎn)灰度值累計(jì)和),xlabel( 列值),ylabel( 累計(jì)像素量);Px0=1;Px 1=1;%分割字符 fo

8、r i=1:7while (X1(1,PxO)3)&(PxO=3)&(Px1x1)|(Px1 -Px0)10)Px1=Px1+1;endZ=l2(:,PxO:Px1,:);switch strcat(Z, nu m2str(i)case Z1PIN0=Z;case Z2PIN 仁Z;case Z3PIN2=Z;case Z4PIN3=Z;case Z5PIN4=Z;case Z6PIN5=Z;otherwisePIN6=Z; end figure(3); subplot(1,7,i); imshow(Z);PxO=Px1;Endfun cti on inpt = pretreatme nt(l

9、)%Y UCHULI Summary of this fun ctio n goes here% Detailed expla nati on goes hereif isrgb(I)I1 = rgb2gray(l);elseI1=I;endI仁imresize(l1,50 20);%將圖片統(tǒng)一劃為 50*20大小I1=im2bw(I1,0.9);m,n=size(I1);in pt=zeros(1,m* n);%各圖像按列轉(zhuǎn)換成一個(gè)行向量for j=1: nfor i=1:min pt(1,m*(j-1)+i)=l1(i,j);endend%神經(jīng)網(wǎng)絡(luò)進(jìn)行識(shí)別。close all;clear

10、all;%一化訓(xùn)練樣本%I0=pretreatme nt(imread(O.jpg);I1=pretreatme nt(imread(1.jpg);I2=pretreatme nt(imread(2.jpg);I3=pretreatme nt(imread(3.jpg);I4=pretreatme nt(imread(4.jpg);I5=pretreatme nt(imread(5.jpg);I6=pretreatme nt(imread(6.jpg);I7=pretreatme nt(imread(7.jpg);I8=pretreatme nt(imread(8.jpg);I9=pretre

11、atme nt(imread(9.jpg);I10=pretreatme nt(imread(A.jpg);I11=pretreatme nt(imread(C.jpg);I12=pretreatme nt(imread(G.jpg);I13=pretreatme nt(imread(L.jpg);I14=pretreatme nt(imread(M.jpg);I15=pretreatme nt(imread(R.jpg);I16=pretreatme nt(imread(H.jpg);I17=pretreatme nt(imread(N.jpg);P=IO,I1,I2,I3,I4,I5,I6

12、,I7,I8,I9,I1O,I11,I12,I13,I14,I15,I16,I17;%輸出樣本%T=eye(18,18);%b神經(jīng)網(wǎng)絡(luò)參數(shù)設(shè)置net=newff(mi nm ax(P),1000,32,18,logsig,logsig,logsig,trai nrp);n et.i nputWeights1,1.i nitFc n =ra ndnr:n et.layerWeights2,1.i nitFc n =ra ndnr:n et.tra in param.epochs=5000;n et.tra in param.show=50;%n et.tra in param.lr=0.003;

13、net.trai nparam.goal=0.0000000001;n et=i nit( net);%訓(xùn)練樣本%n et,tr=trai n(n et,P,T);%測(cè)試%l=imread(DSC01323.jpg);匸imread(DSC01344.jpg);dw=locatio n(l);%車(chē)牌定位PIN0,PIN1,PIN2,PIN3,PIN4,PIN5,PIN6=Stri ngSplit(dw);%字符分割及處理%測(cè)試字符,得到識(shí)別數(shù)值%PINO=pretreatme nt(PINO);PIN1=pretreatme nt(PIN1);PIN2=pretreatme nt(PIN2);

14、PIN3=pretreatme nt(PIN3);PIN4=pretreatme nt(PIN4);PIN5=pretreatme nt(PIN5);PIN6=pretreatme nt(PIN6);P0=PIN0,PIN1,PIN2,PIN3,PIN4,PIN5,PIN6;for i=2:7T0= sim( net ,P0(:,i);T1 = compet (T0);d =find(T1 = 1) - 1if (d=10)str=A:elseif (d=11)str=C;elseif (d=12)str=G:elseif (d=13) str=L:elseif (d=14) str=M:elseif (d=15)str=R:elseif (d=16)str=H:elseif (d=17)str=N:elsestr=nu m2str(d);ends

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論