下载此文档

车牌识别的matlab程序(程序-讲解-模板).docx


文档分类:IT计算机 | 页数:约14页 举报非法文档有奖
1/14
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/14 下载此文档
文档列表 文档介绍
learcloseallI=imread('');subplot(3,2,1);imshow(I),title(' 原始图像');I_gray=rgb2gray(I);车牌分割subplot(3,2,2),imshow(I_gray),title('灰度图像');%======================形态学预处理I_edge=edge(I_gray,'sobel');subplot(3,2,3),imshow(I_edge),title('边缘检测后图像');se=[1;1;1];I_erode=imerode(I_edge,se);subplot(3,2,4),imshow(I_erode),title('腐蚀后边缘图像');se=strel('rectangle',[25,25]);I_close=imclose(I_erode,se);%图像闭合、填充图像subplot(3,2,5),imshow(I_close),title('填充后图像');I_final=bwareaopen(I_close,2000);%去除聚团灰度值小于2000的部分subplot(3,2,6),imshow(I_final),title('形态滤波后图像');%==========================I_new=zeros(size(I_final,1),size(I_final,2));location_of_1=[];fori=1:size(I_final,1)%寻找二值图像中白的点的位置forj=1:size(I_final,2)ifI_final(i,j)==1;newlocation=[i,j];location_of_1=[location_of_1;newlocation];endendendmini=inf;maxi=0;fori=1:size(location_of_1,1)%寻找所有白点中,x坐标与y坐标的和最大,最小的两个点的位置temp=location_of_1(i,1)+location_of_1(i,2);iftemp<minimini=temp;a=i;endiftemp>maximaxi=temp;b=i;endendfirst_point=location_of_1(a,:);%和最小的点为车牌的左上角last_point=location_of_1(b,:);%和最大的点为车牌的右下角x1=first_point(1)+4;%坐标值修正x2=last_point(1)-4;y1=first_point(2)+4;y2=last_point(2)-4;I_plate=I(x1:x2,y1:y2);I_plate=OTSU(I_plate);%以OTSU算法对分割出的车牌进行自适应二值化处理I_plate=bwareaopen(I_plate,50);figure,imshow(I_plate),title('车牌提取')%画出最终车牌%=========================字符分割X=[];flag=0;forj=1:size(I_plate,2)sum_y=sum(I_plate(:,j));iflogical(sum_y)~=flagX=[Xj];flag=logical(sum_y);%用来存放水平分割线的横坐标%列和有变化时,记录下此列endendfigureforn=1:7char=I_plate(:,X(2*n-1):X(2*n)-1); %进行粗分割fori=1:size(char,1)%这两个for循环对分割字符的上下进行裁剪ifsum(char(i,:))~=0top=i;breakendendfori=1:size(char,1)ifsum(char(size(char,1)-i,:))~=0bottom=size(char,1)-i;breakendendchar=char(top:bottom,:);subplot(2,4,n);imshow(char);%归一化为32*16的大小,以便模板匹配%将分割的字符放入Char_i中char=imresize(char,[32,16],'nearest');eval(strcat('Char_',num2str(n),'=char;'));end%==========================字符识别char=[];store1=strcat('京','津','沪','渝','冀','晋','辽','吉','黑','苏','浙'...%汉字识别,'皖','闽','赣','鲁','豫','鄂','湘','粤','琼','川','贵','云','陕'...,'甘','青','藏','桂'

车牌识别的matlab程序(程序-讲解-模板) 来自淘豆网m.daumloan.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数14
  • 收藏数0 收藏
  • 顶次数0
  • 上传人likuilian1
  • 文件大小216 KB
  • 时间2020-10-02