您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 信息化管理 > 用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('³µÅÆÂ˲¨ÅòÕ͸¯Ê´');%Ñ°ÕÒÁ¬ÐøÓÐÎÄ×ֵĿ飬Èô³¤¶È´óÓÚijãÐÖµ£¬ÔòÈÏΪ¸Ã¿éÓÐÁ½¸ö×Ö·û×é³É£¬ÐèÒª·Ö¸î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;whilej~=nwhiles(j)==0j=j+1;endk1=j;whiles(j)~=0&&j=n-1j=j+1;endk2=j-1;ifk2-k1=round(n/6.5)[val,num]=min(sum(d(:,[k1+5:k2-5])));d(:,k1+num+5)=0;%·Ö¸îendend%ÔÙÇиîd=qiege(d);%Çиî³ö7¸ö×Ö·ûy1=10;y2=0.25;flag=0;word1=[];whileflag==0[m,n]=size(d);left=1;wide=0;whilesum(d(:,wide+1))~=0wide=wide+1;endifwidey1%ÈÏΪÊÇ×ó²à¸ÉÈÅd(:,[1:wide])=0;d=qiege(d);elsetemp=qiege(imcrop(d,[11widem]));[m,n]=size(temp);all=sum(sum(temp));two_thirds=sum(sum(temp([round(m/3):2*round(m/3)],:)));iftwo_thirds/ally2flag=1;word1=temp;%WORD1endd(:,[1:wide])=0;d=qiege(d);endend;%·Ö¸î³öµÚ¶þ¸ö×Ö·û[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*16word1=imresize(word1,[3216]);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,21),imshow(word7),title('7');subplot(5,7,22),imshow(word8),title('8');%×Ö·ûͼÏñϸ»¯%word1=bwmorph(word1,'thin',Inf);%word2=bwmorph(word2,'thin',Inf);%word3=bwmorph(word3,'thin',Inf);%word4=bwmorph(word4,'thin',Inf);%word5=bwmorph(word5,'thin',Inf);%word6=bwmorph(word6,'thin',Inf);%word7=bwmorph(word7,'thin',Inf);%subplot(5,7,29),imshow(word1),title('1');%subplot(5,7,30),imshow(word2),title('2');%subplot(5,7,31),imshow(word3),title('3');%subplot(5,7,32),imshow(word4),title('4');%subplot(5,7,33),imshow(word5),title('5');%subplot(5,7,34),imshow(word6),title('6');%subplot(5,7,35),imshow(word7),title('7');%×Ö·û´æ´¢imwrite(word1,'a12.bmp');imwrite(word2,'b12.bmp');imwrite(word3,'a.bmp');imwrite(word4,'c12.bmp');imwrite(word5,'d12.bmp');imwrite(word6,'e12.bmp');imwrite(word7,'f12.bmp');imwrite(word8,'g12.bmp');
本文标题:用matlab编程实现车牌字符的分割
链接地址:https://www.777doc.com/doc-6274603 .html