ocrResults = ocr(businessCard)
recognizedText = ocrResults.Text;
figure
imshow(businessCard)
text(600, 150, recognizedText,'BackgroundColor', [1 1 1])
Sedang HASIL JST:
I=get(handles.axes1,'Userdata');
g=rgb2gray(I);
ED=im2bw(g);
g=medfilt2(g,[3 3]);
set(handles.figure1,'CurrentAxes',handles.axes4);
imshow(g);
set(handles.axes4,'Userdata',g);
set(handles.figure1,'CurrentAxes',handles.axes8);
imshow(ED);
set(handles.axes8,'Userdata',ED);
%**********************************
conc=strel('disk',1);
gi=imdilate(g,conc);
ge=imerode(g,conc); %%%% morphological image processing
gdiff=imsubtract(gi,ge);
gdiff=mat2gray(gdiff);
whos gdiff
gdiff=conv2(gdiff,[1 1;1 1]);
gdiff=imadjust(gdiff,[0.5 0.7],[0 1],.1);
%B=logical(gdiff);
B=im2bw(gdiff);
[a1 b1]=size(B);
set(handles.figure1,'CurrentAxes',handles.axes5);
imshow(B);
set(handles.axes5,'Userdata',B);
er=imerode(B,strel('line',100,0));
out1=imsubtract(B,er);
F=imfill(out1,'holes'); %%%filling the object
H=bwmorph(F,'thin',1);
H=imerode(H,strel('line',3,90));
set(handles.figure1,'CurrentAxes',handles.axes6);
imshow(H);
set(handles.axes6,'Userdata',H);
%%
final=bwareaopen(H,floor((a1/15)*(b1/15)));
final(1:floor(.9*a1),1:2)=1;
final(a1:-1:(a1-20),b1:-1:(b1-2))=1;
set(handles.figure1,'CurrentAxes',handles.axes7);
imshow(ED);
set(handles.axes7,'Userdata',ED);
Iprops=regionprops(final,'BoundingBox','Image');
hold on
for n=1:size(Iprops,1)
V= rectangle('Position',Iprops(n).BoundingBox,'EdgeColor','g','LineWidth',2);
end
hold off
NR=cat(1,Iprops.BoundingBox)
load net.mat;
load datatarget.mat;
gab=[""];
mat=[];
n=1;
for i=1:size(NR,1)
M=NR(i,:)
A=imcrop(ED,M);
if size(A,2)>10
mat(n,:)=M;
n=n+1;
figure (i) , imshow(A);
Q=getEDmulti(A);
H=sim(net_keluaran,Q');
%%%%%%%%%%%%%%%%%%%%%%%%%
b=0;%0.02;
%T=1x126
hasil='1-3 bmp';
if H < T(1,3)+b
hasil='1-3 bmp/a';
elseif H < T(1,6)+b
hasil='4-6 bmp/b';
elseif H < T(1,9)+b
hasil='7-9 bmp/c';
elseif H < T(1,12)+b
hasil='10-12 bmp/d';
elseif H < T(1,15)+b
hasil='13-15 bmp/e';
elseif H < T(1,18)+b
hasil='16-18 bmp/f';
elseif H < T(1,21)+b
hasil='19-21 bmp/g';
elseif H < T(1,24)+b
hasil='22-24 bmp/h';
elseif H < T(1,27)+b
hasil='25-27 bmp/i';
elseif H < T(1,30)+b
hasil='28-30 bmp/j';
elseif H < T(1,33)+b
hasil='31-33 bmp/k';
elseif H < T(1,36)+b
hasil='34-36 bmp/l';
elseif H < T(1,39)+b
hasil='37-39 bmp/m';
elseif H < T(1,42)+b
hasil='40-42 bmp/n';
elseif H < T(1,45)+b
hasil='43-45 bmp/o';
elseif H < T(1,48)+b
hasil='46-48 bmp/p';
elseif H < T(1,51)+b
hasil='49-51 bmp/q';
elseif H < T(1,54)+b
hasil='52-54 bmp/r';
elseif H < T(1,57)+b
hasil='55-57 bmp/s';
elseif H < T(1,60)+b
hasil='58-60 bmp/t';
elseif H < T(1,63)+b
hasil='61-63 bmp/u';
elseif H < T(1,66)+b
hasil='64-66 bmp/v';
elseif H < T(1,69)+b
hasil='67-69 bmp/w';
elseif H < T(1,72)+b
hasil='70-72 bmp/x';
elseif H < T(1,75)+b
hasil='73-75 bmp/y';
elseif H < T(1,78)+b
hasil='76-78 bmp/z';
elseif H < T(1,81)+b
hasil='79-81 bmp/0';
elseif H < T(1,84)+b
hasil='82-84 bmp/1';
elseif H < T(1,87)+b
hasil='85-87 bmp';
elseif H < T(1,90)+b
hasil='88-90 bmp/2';
elseif H < T(1,93)+b
hasil='91-93 bmp/3';
elseif H < T(1,96)+b
hasil='94-96 bmp/4';
elseif H < T(1,99)+b
hasil='97-99 bmp';
elseif H < T(1,102)+b
hasil='100-102 bmp/5';
elseif H < T(1,105)+b
hasil='103-105 bmp/6';
elseif H < T(1,108)+b
hasil='106-108bmp/7';
elseif H < T(1,111)+b
hasil='109-111 bmp/8';
elseif H < T(1,114)+b
hasil='112-114 bmp/9';
end
gab=[gab num2str(H) '#' hasil ','];
%%%%%%%%%%%%%%%%%%%%%%%%%
end
end
toc
set(handles.edResult,'String',num2str(toc));
set(handles.edProses,'String',gab);
jadinya ...ada yg terbaca dan ada yg tak terbaca tergantung ukuran huruf plat dan ukuran tanggal masa berlakunyaaa....
Silakan teman2 kembangkan yaaaa u atur sensitivitasnyaaaa....
Tidak ada komentar:
Posting Komentar