필터 지우기
필터 지우기

How to read special characters using MATLAB in OCR ?

조회 수: 5 (최근 30일)
Shavi
Shavi 2012년 4월 20일
댓글: Walter Roberson 2018년 12월 20일
How to read special characters using MATLAB in OCR ? Special characters like + , / | etc.
or
We can say that how to modify read_letter function which is used to read letters in OCR?
Please help me... Thanks
  댓글 수: 2
Samreen kayani
Samreen kayani 2018년 12월 20일
%CREATE TEMPLATES
%Letter
clc;
close all;
A=imread('letters_numbers\A.bmp');B=imread('letters_numbers\B.bmp');
C=imread('letters_numbers\C.bmp');D=imread('letters_numbers\D.bmp');
E=imread('letters_numbers\E.bmp');F=imread('letters_numbers\F.bmp');
G=imread('letters_numbers\G.bmp');H=imread('letters_numbers\H.bmp');
I=imread('letters_numbers\I.bmp');J=imread('letters_numbers\J.bmp');
K=imread('letters_numbers\K.bmp');L=imread('letters_numbers\L.bmp');
M=imread('letters_numbers\M.bmp');N=imread('letters_numbers\N.bmp');
O=imread('letters_numbers\O.bmp');P=imread('letters_numbers\P.bmp');
Q=imread('letters_numbers\Q.bmp');R=imread('letters_numbers\R.bmp');
S=imread('letters_numbers\S.bmp');T=imread('letters_numbers\T.bmp');
U=imread('letters_numbers\U.bmp');V=imread('letters_numbers\V.bmp');
W=imread('letters_numbers\W.bmp');X=imread('letters_numbers\X.bmp');
Y=imread('letters_numbers\Y.bmp');Z=imread('letters_numbers\Z.bmp');
%lower case letters
a=imread('letters_numbers\a.png');b=imread('letters_numbers\b.png');
c=imread('letters_numbers\c.png');d=imread('letters_numbers\d.png');
e=imread('letters_numbers\e.png');f=imread('letters_numbers\f.png');
g=imread('letters_numbers\g.png');h=imread('letters_numbers\h.png');
i=imread('letters_numbers\i.png');j=imread('letters_numbers\j.png');
k=imread('letters_numbers\k.png');l=imread('letters_numbers\l.png');
m=imread('letters_numbers\m.png');n=imread('letters_numbers\n.png');
o=imread('letters_numbers\o.png');p=imread('letters_numbers\p.png');
q=imread('letters_numbers\q.png');r=imread('letters_numbers\r.png');
s=imread('letters_numbers\s.png');t=imread('letters_numbers\t.png');
u=imread('letters_numbers\u.png');v=imread('letters_numbers\v.png');
w=imread('letters_numbers\w.png');x=imread('letters_numbers\x.png');
y=imread('letters_numbers\y.png');z=imread('letters_numbers\z.png');
%Number
one=imread('letters_numbers\1.bmp'); two=imread('letters_numbers\2.bmp');
three=imread('letters_numbers\3.bmp');four=imread('letters_numbers\4.bmp');
five=imread('letters_numbers\5.bmp'); six=imread('letters_numbers\6.bmp');
seven=imread('letters_numbers\7.bmp');eight=imread('letters_numbers\8.bmp');
nine=imread('letters_numbers\9.bmp'); zero=imread('letters_numbers\0.bmp');
%*-*-*-*-*-*-*-*-*-*-*-
letter=[A B C D E F G H I J K L M...
N O P Q R S T U V W X Y Z];
number=[one two three four five...
six seven eight nine zero];
lowercase = [a b c d e f g h i j k ...
l m n o p q r s t u v w x y z];
character=[letter number lowercase];
templates=mat2cell(character,42,[24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 24 ...
24 24]);
save ('templates','templates')
clear all
i am facing problem while load .bmp files
can you please help me
Walter Roberson
Walter Roberson 2018년 12월 20일
What leads you to suspect that you are having trouble loading bmp files?
Are you using MS Windows? Do you have a directory named letters_numbers in your current folder? Do the noted files exist inside that folder?
The code given is not suitable for Mac or Linux: for those, all of the \ inside the file names should be changed to / . MS Windows supports / as well as \ so the code would be more general if / were to be used. But better yet would be to convert to use a named directory and fullfile()

댓글을 달려면 로그인하십시오.

답변 (3개)

Aliyu Abdu
Aliyu Abdu 2012년 5월 3일
You can check for "OCR.." in the "file exchanger", or you can simply try the code;
%CREATE TEMPLATES
%Letter
clc;
close all;
A=imread('letters_numbers\A.bmp');B=imread('letters_numbers\B.bmp');
C=imread('letters_numbers\C.bmp');D=imread('letters_numbers\D.bmp');
E=imread('letters_numbers\E.bmp');F=imread('letters_numbers\F.bmp');
G=imread('letters_numbers\G.bmp');H=imread('letters_numbers\H.bmp');
I=imread('letters_numbers\I.bmp');J=imread('letters_numbers\J.bmp');
K=imread('letters_numbers\K.bmp');L=imread('letters_numbers\L.bmp');
M=imread('letters_numbers\M.bmp');N=imread('letters_numbers\N.bmp');
O=imread('letters_numbers\O.bmp');P=imread('letters_numbers\P.bmp');
Q=imread('letters_numbers\Q.bmp');R=imread('letters_numbers\R.bmp');
S=imread('letters_numbers\S.bmp');T=imread('letters_numbers\T.bmp');
U=imread('letters_numbers\U.bmp');V=imread('letters_numbers\V.bmp');
W=imread('letters_numbers\W.bmp');X=imread('letters_numbers\X.bmp');
Y=imread('letters_numbers\Y.bmp');Z=imread('letters_numbers\Z.bmp');
%lower case letters
a=imread('letters_numbers\a.png');b=imread('letters_numbers\b.png');
c=imread('letters_numbers\c.png');d=imread('letters_numbers\d.png');
e=imread('letters_numbers\e.png');f=imread('letters_numbers\f.png');
g=imread('letters_numbers\g.png');h=imread('letters_numbers\h.png');
i=imread('letters_numbers\i.png');j=imread('letters_numbers\j.png');
k=imread('letters_numbers\k.png');l=imread('letters_numbers\l.png');
m=imread('letters_numbers\m.png');n=imread('letters_numbers\n.png');
o=imread('letters_numbers\o.png');p=imread('letters_numbers\p.png');
q=imread('letters_numbers\q.png');r=imread('letters_numbers\r.png');
s=imread('letters_numbers\s.png');t=imread('letters_numbers\t.png');
u=imread('letters_numbers\u.png');v=imread('letters_numbers\v.png');
w=imread('letters_numbers\w.png');x=imread('letters_numbers\x.png');
y=imread('letters_numbers\y.png');z=imread('letters_numbers\z.png');
%Number
one=imread('letters_numbers\1.bmp'); two=imread('letters_numbers\2.bmp');
three=imread('letters_numbers\3.bmp');four=imread('letters_numbers\4.bmp');
five=imread('letters_numbers\5.bmp'); six=imread('letters_numbers\6.bmp');
seven=imread('letters_numbers\7.bmp');eight=imread('letters_numbers\8.bmp');
nine=imread('letters_numbers\9.bmp'); zero=imread('letters_numbers\0.bmp');
%*-*-*-*-*-*-*-*-*-*-*-
letter=[A B C D E F G H I J K L M...
N O P Q R S T U V W X Y Z];
number=[one two three four five...
six seven eight nine zero];
lowercase = [a b c d e f g h i j k ...
l m n o p q r s t u v w x y z];
character=[letter number lowercase];
templates=mat2cell(character,42,[24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 24 ...
24 24]);
save ('templates','templates')
clear all
  댓글 수: 4
Shavi
Shavi 2012년 5월 7일
okay dats fine..
The problem is suppose we have smallcase letter 'c' and uppercase letter 'C'.
So i want to know how to differentiate between these two while matching templates?
Thanks Abdu!!
ayushi
ayushi 2016년 6월 26일
sir i can't able to find the correct example for special characters template matching method how to do the template matching of "@,+)*&%^$" all those special characters please help me to find out the correct procedure i have already cropped the templates and stored it in the folder and now i am not getting how to add those in the array when i am directly writting the special characters its showing error how to do please guide me ..thank you

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2012년 4월 20일
Mathworks does not supply any routine named "read_letter".
I see that there are multiple contributions in the MATLAB File Exchange that include routines named "read_letter". If you are using one of those, people would need to know which one in order to have a chance of providing advice.
  댓글 수: 5
Walter Roberson
Walter Roberson 2012년 5월 3일
Is "c" a "special character", or did you switch topics?
Shavi
Shavi 2012년 5월 7일
no no ...
actually c is a smallcase letter 'C'.
So i want to know how to differentiate between these two while matching templates?
I know that this ques is not about special characters but i need the solution for this one too.
Thanks Roberson!!

댓글을 달려면 로그인하십시오.


HanBaba
HanBaba 2018년 3월 25일
Can anyone please tell me why we have taken 42 & 24 ? any theory behind this ? I'll be waiting for your positive reply !
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 3월 25일
This is just based upon the available training data.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by