资源简介

场景文字 检测 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

评论

共有 条评论