資源簡(jiǎn)介
基于圖像的條形碼識(shí)別程序(識(shí)別EAN13碼),只要條形碼的背景部分是純色,程序就能有相當(dāng)強(qiáng)的魯棒性。
代碼片段和文件信息
function?EAN_13=barcode(f0)
EAN_13=-ones(113);
f1=rgb2gray(f0);
f2=medfilt2(f1);
w=[-1?-1?-1;-1?8?-1;-1?-1?-1];
f3=imfilter(f2w‘replicate‘);
f4=f2+f3;
f5=im2double(f4);
f6=mat2gray(f5);
T=graythresh(f6);
f7=f6>=T;
f8=medfilt2(f7);
figureimshow(f8);
[f9t]=edge(f8‘roberts‘);
figureimshow(f9);
fai=0.5;
[Hthetarho]=hough(f9fai);
[rchnew]=houghpeaks(H20);
range=fai*(c-1)-(90-fai);
angle=median(range);
rotate=(90+angle)*pi/180;
matrix=[cos(rotate)?sin(rotate)?0;-sin(rotate)?cos(rotate)?0;0?0?1];
tform=maketform(‘a(chǎn)ffine‘matrix);
f10=imtransform(f8tform‘FillValue‘1);
figureimshow(f10);
[MN]=size(f10);
boundary=zeros(MN);
sum=zeros(1M);
threshold=2;
for?i=1:M
????status=true;
????for?j=1:N
????????if?status?==?true
????????????if?f10(ij)==0
??
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????1435114??2010-01-16?21:54??圖像條形碼識(shí)別程序\3.bmp
?????文件??????12511??2010-01-19?10:53??圖像條形碼識(shí)別程序\barcode.m
?????文件???????1024??2010-01-17?17:42??圖像條形碼識(shí)別程序\hough.m
?????文件???????1077??2010-01-17?17:18??圖像條形碼識(shí)別程序\houghpeaks.m
?????文件????????149??2010-01-19?10:57??圖像條形碼識(shí)別程序\Readme.txt
????..A.SH.?????48640??2010-01-19?11:02??圖像條形碼識(shí)別程序\Thumbs.db
?????目錄??????????0??2010-01-23?02:07??圖像條形碼識(shí)別程序
-----------?---------??----------?-----??----
??????????????1498515????????????????????7
評(píng)論
共有 條評(píng)論