資源簡介
場景文字 檢測 matlab 源碼,來自github代碼可以參考一下,歡迎下載看看,代碼很多仔細看和分析,一定會有所收獲

代碼片段和文件信息
clc;
clear;
close?all;
savepath=‘F:\project\result\‘;
Files?=?dir(strcat(‘F:\project\textloc\‘‘*.jpg‘));
LengthFiles?=?length(Files);
for?ii?=?1:LengthFiles;
????I?=?imread(strcat(‘F:\project\textloc\‘Files(ii).name));
???????
Para=[1.516230.35011];
C=Para(1);
T_angle=Para(2);
sig=Para(3);
H=Para(4);
L=Para(5);
Endpoint=Para(6);
Gap_size=Para(7);
Height=size(I1);
Width=size(I2);
if?Height>Width&&Height~=640????????%圖像統一規格
????I=imresize(I[640?NaN]);
elseif?Height ????I=imresize(I[NaN?640]);
end;
Height=size(I1);
Width=size(I2);
I1=I;???????????????????????????????%I1是RGB圖像,I是灰度圖
if?size(I3)==3
????I=rgb2gray(I);?%?Transform?RGB?image?to?a?Gray?one.?
end
tic
BW=EDGE(I‘canny‘[LH]);??%?Detect?edges
time_for_detecting_edge=toc
%figure(1)imshow(BW);
tic
[curvecurve_startcurve_endcurve_modecurve_num]=extract_curve(BWGap_size);??%?Extract?curves
time_for_extracting_curve=toc
tic
cout=get_corner(curvecurve_startcurve_endcurve_modecurve_numBWsigEndpointCT_angle);?%?Detect?corners
time_for_detecting_corner=toc
img=I;
for?i=1:size(cout1)
????img=mark(imgcout(i1)cout(i2)5);
end
marked_img=img;
%figure(1)??????????????????????????%角點檢測結果
%imshow(marked_img);
%title(‘Detected?corners‘)
%imwrite(marked_img‘corner.jpg‘);
sm=SaliencySR(I);???????????????????%顯著性檢測結果
%figure(2)imshow(sm);
coutt_count=0;??????????????????????%刪除顯著性差的點
for?i=1:size(cout1)????????????????
????gv=sm(cout(i1)cout(i2));
????if?gv<0.17
????????cout(i1)=0;
????????cout(i2)=0;
????else?coutt_count=coutt_count+1;
????end
end
coutt=updatecor(coutcoutt_count);
couttt_count=0;?????????????????????%刪除單獨孤立和邊緣的點
disarry=zeros(coutt_count-11);
for?m=1:size(coutt1)
????j=1;
????for?n=1:size(coutt1)
????????if?m~=n
????????????dis=sqrt((coutt(m1)-coutt(n1)).^2+(coutt(m2)-coutt(n2)).^2);
????????????disarry(j1)=dis;
????????????j=j+1;
????????end
????end
????if?min(disarry(:1))>50||coutt(m1)<20||coutt(m2)<20||coutt(m1)>(Height-20)||coutt(m2)>(Width-20)
????????coutt(m1)=0;
????????coutt(m2)=0;
????else?couttt_count=couttt_count+1;
????end
end
couttt=updatecor(couttcouttt_count);
??????
%figure(3)???????????????????????????%畫出剩余角點
%plot(couttt(:2)couttt(:1)‘r+‘);
%axis([04800640]);
%set(gca‘ydir‘‘reverse‘‘xaxislocation‘‘top‘);
global?div;
div=10;
[corsegsdrsdc]=Location(coutttHeightWidth);%分格統計角點數目以及最密集格子坐標
global?table;
table=corseg;
global?labtab;
labtab=zeros(div);
Corsprd(sdrsdc);??????????????????????????????%標記文本區格子
locrow=zeros(101);
loccol=zeros(101);
[locrowloccol]=find(labtab==1);
dhgg=floor(Height./div);
dwdd=floor(Width./div);
top=(min(locrow)-1)*dhgg;
if?top==0
????top=1;
end
bottom=max(locrow)*dhgg;
left=(min(loccol)-1)*dwdd;
if?left==0
????left=1;
end
right=max(loccol)*dwdd;
I22=Display(I1topbottomleftright1);?%計算文本區邊際坐標,進行文本粗定位
%figure(4)imshow(I22[]);
I2=I(top:bottomleft:right);
edim2=EDGE(I2‘canny‘[00.35]);???????????%?Detect?edges
%figure(5)imshow(edim2);
[lnc
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-03-02?07:19??Image-Text-Detection-master\
?????文件?????????211??2015-03-02?07:19??Image-Text-Detection-master\README.md
?????目錄???????????0??2015-03-02?07:19??Image-Text-Detection-master\my?thesis_code?final\
?????文件?????????700??2015-03-02?07:19??Image-Text-Detection-master\my?thesis_code?final\Corsprd.m
?????文件????????1126??2015-03-02?07:19??Image-Text-Detection-master\my?thesis_code?final\Display.m
?????文件????????1464??2015-03-02?07:19??Image-Text-Detection-master\my?thesis_code?final\Hor_pro.m
?????文件?????????427??2015-03-02?07:19??Image-Text-Detection-master\my?thesis_code?final\Location.m
?????文件?????????487??2015-03-02?07:19??Image-Text-Detection-master\my?thesis_code?final\SaliencySR.m
?????文件????????2211??2015-03-02?07:19??Image-Text-Detection-master\my?thesis_code?final\Ver_pro.m
?????文件????????4076??2015-03-02?07:19??Image-Text-Detection-master\my?thesis_code?final\corner.m
?????文件????????1679??2015-03-02?07:19??Image-Text-Detection-master\my?thesis_code?final\curve_tangent.m
?????文件????????2067??2015-03-02?07:19??Image-Text-Detection-master\my?thesis_code?final\extract_curve.m
?????文件????????4923??2015-03-02?07:19??Image-Text-Detection-master\my?thesis_code?final\get_corner.m
?????文件?????????795??2015-03-02?07:19??Image-Text-Detection-master\my?thesis_code?final\mark.m
?????文件?????????591??2015-03-02?07:19??Image-Text-Detection-master\my?thesis_code?final\parse_inputs.m
?????文件?????????233??2015-03-02?07:19??Image-Text-Detection-master\my?thesis_code?final\updatecor.m
?????文件?????????829??2017-06-28?15:09??AppServ.lnk
評論
共有 條評論