车牌识别matlab程序.doc

车牌识别matlab程序.doc

ID:50435111

大小:39.52 KB

页数:4页

时间:2020-03-09

车牌识别matlab程序.doc_第1页
车牌识别matlab程序.doc_第2页
车牌识别matlab程序.doc_第3页
车牌识别matlab程序.doc_第4页
资源描述:

《车牌识别matlab程序.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、[filename,pathname]=uigetfile({'*.jpg','JPEG文件(*.jpg)';'*.bmp','BMP文件(*.bmp)';});if(filename==0),return,endglobalFILENAME%声明全局变量FILENAME=[pathnamefilename];I=imread(FILENAME);imshow(I);%显示图像II1=rgb2gray(I);%RGB图转化为灰度图figure,imshow(I1);w1=medfilt2(I1);figure,imshow(w1);s1=histeq(w1,256

2、);figure,imshow(s1);t1=imadjust(s1);figure,imshow(t1);I2=edge(t1,'robert',0.15,'both');%用ROBERT算子提取图像边缘figure,imshow(I2);se=[1;1;1];I3=imerode(I2,se);%弱化二进制图像I2的边缘figure,imshow(I3);%为定位车牌,将白色区域膨胀,腐蚀去无关的小物件,包括车牌字符(下面两句)se=strel('rectangle',[25,20]);%用来腐蚀的形状为矩形,面积20*25I4=imclose(I3,se);

3、figure,imshow(I4);I5=bwareaopen(I4,2000);%去除图像中面积过小的,可以肯定不是车牌的区域。figure,imshow(I5);[y,x,z]=size(I5);%z=1。y,x分别为I5图像的高和宽myI=double(I5)%myI=I5;tic%begin横向扫描white_y=zeros(y,1);%white_y为y行1列的零矩阵fori=1:yforj=1:xif(myI(i,j,1)==1)%如果myI(i,j,1)即myI图像中坐标为(i,j)的点为白色%则white_y的相应行的元素white_y(i,1)值

4、加1white_y(i,1)=white_y(i,1)+1;endendend[tempMaxY]=max(white_y);%temp为向量white_y的元素中的最大值,MaxY为该值的索引(在向量中的位置)PY1=MaxY;while((white_y(PY1,1)>=80)&&(PY1>1))PY1=PY1-1;endPY2=MaxY;while((white_y(PY2,1)>=80)&&(PY2

5、扫描white_x=zeros(1,x);forj=1:xfori=PY1:PY2if(myI(i,j,1)==1)white_x(1,j)=white_x(1,j)+1;endendendPX1=1;while((white_x(1,PX1)<3)&&(PX1PX1))PX2=PX2-1;end%end纵向扫描PX1=PX1-2;PX2=PX2+2;Plate=I(PY1:PY2,:);t=tocfigure,plot(white_y);gridfigur

6、e,plot(white_x);gridfigure,imshow(IY);figure,imshow(Plate);%ifisrgd(Plate);Plate3=rgb2gray(Plate);%else%Plate2=Plate;%endplate4=medfilt2(Plate3);plate5=histeq(plate4,256);Plate2=imadjust(plate5);g_max=double(max(max(Plate2)));g_min=double(min(min(Plate2)));t=round(g_max-(g_max-g_min)/

7、2);[m,n]=size(Plate2);Plate2=im2bw(Plate2,t/256);figure,imshow(Plate2);plate=bwareaopen(Plate2,20);figure,imshow(plate);[y1,x1,z1]=size(plate);plate1=double(plate);%tt=1;Y1=zeros(y1,1);fori=1:y1forj=1:x1if(plate1(i,j,1)==1)Y1(i,1)=Y1(i,1)+1;endendendpy1=1;py0=1;while((Y1(py0,1)<20)&&(

8、py0

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。