function [PY2,PY1,PX2,PX1]=caitu_tiqu(I,I_bai)
[y,x,z]=size(I);
myI=double(I);
Y_threshlow=5;%这个数值很重要。决定了提取的彩图的质量
X_firrectify=5;%ganrao transaction
%====================== Y 方向============================
Blue_y=zeros(y,1);
for i=1:y
for j=1:x
% if (myI(i,j,1)<=48)&&(myI(i,j,2)>=40)&&(myI(i,j,2)<=90)&&(myI(i,j,3)<=220)&&(myI(i,j,3)>=80)
% if((myI(i,j,1)<=48)&&((myI(i,j,2)<=100)&&(myI(i,j,2)>=40))&&((myI(i,j,3)<=200)&&(myI(i,j,3)>=80)))
if ((myI(i,j,1)<=0.7)&&(myI(i,j,1)>=0.6)&&((myI(i,j,2)<=1.8)&&(myI(i,j,2)>=0.6))&&((myI(i,j,3)<=1.7)&&(myI(i,j,3)>=0.4)))
Blue_y(i,1)= Blue_y(i,1)+1; % 蓝色象素点统计
end
end
end
baisebili=0;changkuanbi=0;
k=0;
while(~((baisebili>=0.12)&&(baisebili<=0.5)&&(changkuanbi>=0.20)&&(changkuanbi<=0.6)))%gai shan qingxie
if (k==0)%第一次进来
[temp MaxY]=max(Blue_y);% Y方向车牌区域确定 temp(最多点数):所有行中,最多的累积像素点 MaxY(最多点所在行):该行中蓝点最多
if temp<=20%2048*1536 照相
msgbox('车牌定位出错','warning');
wavplay(wavread('车牌定位出错.wav'),22000);
pause;
end
PY1=MaxY;%有最多蓝点的行付给PY1
while ((Blue_y(PY1,1)>=Y_threshlow)&&(PY1>1))%找到图片上边界
PY1=PY1-1;
end
%PY1:存储车牌上边界值
PY2=MaxY;
while ((Blue_y(PY2,1)>=Y_threshlow)&&(PY2<y))%阈值为5
PY2=PY2+1;
end
PY1, PY2
%==============X 方向===============================
X_threshhigh=(PY2-PY1)/11;%这个数值很重要。决定了提取的彩图的质量,适当提高可抗干扰,但是小图会照成剪裁太多
Blue_x=zeros(1,x); % 进一步确定X方向的车牌区域
for j=1:x
for i=PY1:PY2
% if((myI(i,j,1)<=48)&&((myI(i,j,2)<=90)&&(myI(i,j,2)>=30))&&((myI(i,j,3)<=160)&&(myI(i,j,3)>=80)))
% if((myI(i,j,1)<=65)&&((myI(i,j,2)<=100)&&(myI(i,j,2)>=40))&&((myI(i,j,3)<=160)&&(myI(i,j,3)>=90)))%这里由82修改成90.因为图片20090504809
if ((myI(i,j,1)<=0.7)&&(myI(i,j,1)>=0.6)&&((myI(i,j,2)<=1.8)&&(myI(i,j,2)>=0.6))&&((myI(i,j,3)<=1.7)&&(myI(i,j,3)>=0.4)))
Blue_x(1,j)= Blue_x(1,j)+1;
end
end
end
[temp MaxX]=max(Blue_x);
PX1=MaxX-6*(PY2-PY1);
if PX1<=1
PX1=1;
end
while ((Blue_x(1,PX1)<=X_threshhigh)&&(PX1<x))%阈值
PX1=PX1+1;
end %确定出X方向车牌起点
PX2=MaxX+6*(PY2-PY1);
if PX2>=x
PX2=x;
end
while ((Blue_x(1,PX2)<=X_threshhigh)&&(PX2>PX1))%阈值
PX2=PX2-1;
end%确定出X方向车牌终点
% PX1=1;
% while ((Blue_x(1,PX1)<=X_threshhigh)&&(PX1<x))%阈值
% PX1=PX1+1;
% end %确定出X方向车牌起点
% PX2=x;
% while ((Blue_x(1,PX2)<X_threshhigh)&&(PX2>PX1))%阈值
% PX2=PX2-1;
% end%确定出X方向车牌终点
PX1 ,PX2
%=========================================================
a=PY2-PY1+1;b=PX2-PX1+1;
White=0;
for i=PY1:PY2
for j=PX1:PX2
if (std([I_bai(i,j,1) I_bai(i,j,2) I_bai(i,j,3)],1,2)<=22)&&(I_bai(i,j,1)>=90)&&(I_bai(i,j,1)<=255)
White= White+1; % 白色象素点统计
end
end
end
baisebili=White/(a*b)
changkuanbi=a/b
k=k+1
%===========================蓝色区域不是车牌区域=================
elseif (k~=0)
Blue_y(PY1:PY2,1)=0;
[temp MaxY]=max(Blue_y);
if temp<=20%2048*1536 照相
msgbox('车牌定位出错','warning');
wavplay(wavread('车牌定位出错.wav'),22000);
pause;
end
PY1=MaxY;
while ((Blue_y(PY1,1)>=Y_threshlow)&&(PY1>1))%找到图片上边界 %阈值为5
PY1=PY1-1;
end
%PY1:存储车牌上边界值
PY2=MaxY;
while ((Blue_y(PY2,1)>=Y_threshlow)&&(PY2<y))%阈值为5
PY2=PY2+1;
end
PY1, PY2
%==============2次寻找X方向===============================
X_threshhigh=(PY2-PY1)/15;%这个数值很重要。决定了提取的彩图的质量,适当提高可抗干扰,但是小图会照成剪裁太多,ganrao
Blue_x=zeros(1,x); % 进一步确定X方向的车牌区域
for j=1:x
for i=PY1:PY2
%if((myI(i,j,1)<=45)&&((myI(i,j,2)<=90)&&(myI(i,j,2)>=20))&&((myI(i,j,3)<=160)&&(myI(i,j,3)>=80)))
if ((myI(i,j,1)<=0.7)&&(myI(i,j,1)>=0.6)&&((myI(i,j,2)<=1.8)&&(myI(i,j,2)>=0.6))&&((myI(i,j,3)<=1.7)&&(myI(i,j,3)>=0.4)))
Blue_x(1,j)= Blue_x(1,j)+1;
end
end
end
%这里修改成了从中间向两边扩展,这个方法不好。因车牌中间某些位置可能出现断层。
%采用增强型两边往中间收缩。
[temp MaxX]=max(Blue_x);
PX1=MaxX-6*(PY2-PY1);
if PX1<=1
PX1=1;
end
while ((Blue_x(1,PX1)<=X_threshhigh)&&(PX1<x))%阈值
PX1=PX1+1;
end %确定出X方向车牌起点
PX2=MaxX+6*(PY2-PY1);
if PX2>=x
PX2=x;
end
while ((Blue_x(1,PX2)<=X_threshhigh)&&(PX2>PX1))%阈值
PX2=PX2-1;
end%确定出X方向车牌终点
% PX1=1;
% while ((Blue_x(1,PX1)<=X_threshhigh)&&(PX1<x))%阈值
% PX1=PX1+1;
% end
% PX2=x;
% while ((Blue_x(1,PX2)<X_threshhigh)&&(PX2>PX1))%阈值
% PX2=PX2-1;
% end
PX1 ,PX2
%=========================================================
a=PY2-PY1+1;b=PX2-PX1+1;
White=0;
for i=PY1:PY2
for j=PX1:PX2
if (std([I_bai(i,j,1) I_bai(i,j,2) I_bai(i,j,3)],1,2)<=16)&&(I_bai(i,j,1)>=90)&&(I_bai(i,j,1)<=255)
White= White+1; % 白色象素点统计
end
end
end
baisebili=White/(a*b)
changkuanbi=a/b
k=k+1
end
end
%========================================================
Y_firrectify=fix((PY2-PY1)/5);%适当扩大这个值可以正确旋转
PY1=PY1-Y_firrectify;%对车牌区域的修正,向上
PY2=PY2+Y_firrectify;%对车牌区域的修正,向下
% IY=I(PY1:PY2,:,:);%在Y方向对图片截取
PX1=PX1-X_firrectify;% 对车牌区域的修正
PX2=PX2+X_firrectify;% 对车牌区域的修正,
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
近年来,汽⻋牌照自动识别技术已经越来越受到人们的重视,⻋牌自动识别技术的关键在于⻋牌定位、字符切割、字符识别及后续处理等。由于受到运算速度及内存大小的限制,以往的⻋牌识别大都是基于灰度图象处理的识别技术。首先要求正确检测出⻋牌区域,如通过Hough变换以检测直线来提取⻋牌边界区域、使用灰度分割及区域生⻓进行区域分割,或使用纹理特征分析技术等。Hough变换的方法在⻋牌区域变形或图象被污损情况下容易失效,而灰度分割则比直线检测的方法要稳定,但当图象在有许多与⻋牌的灰度非常相似的区域时,该方法也容易失效。纹理分析在遇到类似⻋牌纹理特征的其他因素干扰时,⻋牌定位正确率也会受到影响。所以选用了基于⻋牌彩色信息的彩色分割方法。
资源推荐
资源详情
资源评论
收起资源包目录
车牌识别.zip (86个子文件)
车牌识别
caitu_tiqu.m 7KB
23.BMP 52KB
.DS_Store 10KB
19.BMP 50KB
10.BMP 46KB
20.BMP 46KB
22.BMP 4KB
shibieshuzi.m 446B
29.BMP 5KB
16.BMP 41KB
duquzimu.m 2KB
2.BMP 19KB
15.BMP 44KB
caitu_fenge.m 6KB
27.BMP 43KB
汽车图片
015.jpg 593KB
05.jpg 603KB
06.jpg 627KB
.DS_Store 8KB
019.jpg 440KB
017.jpg 613KB
024.jpg 495KB
014.jpg 728KB
09.jpg 750KB
026.jpg 543KB
010.jpg 749KB
027.jpg 189KB
012.jpg 727KB
020.jpg 634KB
011.jpg 689KB
02.jpg 628KB
021.jpg 474KB
028.jpg 171KB
013.jpg 590KB
022.jpg 606KB
023.jpg 645KB
018.jpg 636KB
07.jpg 461KB
025.jpg 658KB
08.jpg 535KB
03.jpg 656KB
016.jpg 501KB
01.jpg 616KB
04.jpg 560KB
main.m 5KB
shibiezimu.m 2KB
21.BMP 17KB
ceshi.mlx 2.59MB
CPYUE.BMP 2KB
32.BMP 50KB
9.BMP 45KB
cpguizhou.bmp 2KB
8.BMP 19KB
duqushuzi.m 1KB
SEC_xiuzheng.m 855B
17.BMP 4KB
5.BMP 19KB
28.BMP 4KB
7.BMP 44KB
31.BMP 4KB
shibiehanzi.m 682B
rando_bianhuan.m 395B
25.BMP 4KB
3.BMP 18KB
1.BMP 18KB
12.BMP 38KB
30.BMP 5KB
18.BMP 4KB
13.BMP 71KB
6.BMP 31KB
CPJING.BMP 2KB
4.BMP 19KB
0.BMP 34KB
11.BMP 67KB
33.BMP 32KB
touying.m 2KB
24.BMP 47KB
duquszzm.m 3KB
shuzifenge.m 1KB
shibiezm_sz.m 2KB
CPSU.BMP 2KB
26.BMP 76KB
duquhanzi.m 632B
14.BMP 33KB
车牌识别介绍.doc 1.08MB
CPGUI.BMP 51KB
共 86 条
- 1
资源评论
匿名用户小易
- 粉丝: 243
- 资源: 17
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功