ocr problem

2 Ansichten (letzte 30 Tage)
FIR
FIR am 25 Okt. 2011
Bearbeitet: Torsten am 24 Okt. 2023
jan this is the code for read_letter
function letter=read_letter(imagn,num_letras)
% Computes the correlation between template and input image
% and its output is a string containing the letter.
% Size of 'imagn' must be 42 x 24 pixels
% Example:
% imagn=imread('D.bmp');
% letter=read_letter(imagn)
global templates
comp=[ ];
for n=1:num_letras
sem=corr2(templates{1,n},imagn);
comp=[comp sem];
end
vd=find(comp==max(comp));
%*-*-*-*-*-*-*-*-*-*-*-*-*-
if vd==1
letter='A';
elseif vd==2
letter='B';
elseif vd==3
letter='C';
elseif vd==4
letter='D';
elseif vd==5
letter='E';
elseif vd==6
letter='F';
elseif vd==7
letter='G';
elseif vd==8
letter='H';
elseif vd==9
letter='I';
elseif vd==10
letter='J';
elseif vd==11
letter='K';
elseif vd==12
letter='L';
elseif vd==13
letter='M';
elseif vd==14
letter='N';
elseif vd==15
letter='O';
elseif vd==16
letter='P';
elseif vd==17
letter='Q';
elseif vd==18
letter='R';
elseif vd==19
letter='S';
elseif vd==20
letter='T';
elseif vd==21
letter='U';
elseif vd==22
letter='V';
elseif vd==23
letter='W';
elseif vd==24
letter='X';
elseif vd==25
letter='Y';
elseif vd==26
letter='Z';
%*-*-*-*-*
elseif vd==27
letter='1';
elseif vd==28
letter='2';
elseif vd==29
letter='3';
elseif vd==30
letter='4';
elseif vd==31
letter='5';
elseif vd==32
letter='6';
elseif vd==33
letter='7';
elseif vd==34
letter='8';
elseif vd==35
letter='9';
else
letter='0';
end

Akzeptierte Antwort

Naz
Naz am 25 Okt. 2011
Check out this similar problem. Instead of having so much else ifs, do a conversion of a number to string. That is, 'A' is a 65, so, you can say letter=num2str(sv+64). In this case, if sv=1, the sum is 65 and if you do number-to-string conversion you will get an 'A'. Notice, for numbers,if you can encode the '0' as vd==27 and '9' as vd==35, it will be easier to code.
  2 Kommentare
FIR
FIR am 25 Okt. 2011
Naz please look at this link
http://www.mathworks.in/matlabcentral/answers/19134-error-reading-special-character-using-ocr
where i have posted the questions for this problem
tariq
tariq am 24 Okt. 2023
Bearbeitet: Torsten am 24 Okt. 2023
كيف يمكنني الكشف عن رقم لوحة السيارة في ocrالماتلاب عِنـديّ مشكلة بال
How can I find the car plate number in OCR Matlab? I have a problem

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 25 Okt. 2011
The long if/else chain can be replaced by:
transtab = ['A':'Z' '1':'9'];
if vd < 1 || vd > length(transtab)
letter = '0';
else
letter = transtab(vd);
end
  2 Kommentare
FIR
FIR am 28 Okt. 2011
walter ,yet my problem is not solved
FIR
FIR am 28 Okt. 2011
walter can u answer to my question in this link
http://www.mathworks.com/matlabcentral/answers/19165-output-in-frequency-bands

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by