-
Notifications
You must be signed in to change notification settings - Fork 0
/
Letter_detection.m
88 lines (84 loc) · 1.52 KB
/
Letter_detection.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
function letter=readLetter(snap)
load NewTemplates
snap=imresize(snap,[42 24]);
rec=[ ];
for n=1:length(NewTemplates)
cor=corr2(NewTemplates{1,n},snap);
rec=[rec cor];
end
ind=find(rec==max(rec));
display(ind);
if ind==1 || ind==2
letter='A';
elseif ind==3 || ind==4
letter='B';
elseif ind==5
letter='C';
elseif ind==6 || ind==7
letter='D';
elseif ind==8
letter='E';
elseif ind==9
letter='F';
elseif ind==10
letter='G';
elseif ind==11
letter='H';
elseif ind==12
letter='I';
elseif ind==13
letter='J';
elseif ind==14
letter='K';
elseif ind==15
letter='L';
elseif ind==16
letter='M';
elseif ind==17
letter='N';
elseif ind==18 || ind==19
letter='O';
elseif ind==20 || ind==21
letter='P';
elseif ind==22 || ind==23
letter='Q';
elseif ind==24 || ind==25
letter='R';
elseif ind==26
letter='S';
elseif ind==27
letter='T';
elseif ind==28
letter='U';
elseif ind==29
letter='V';
elseif ind==30
letter='W';
elseif ind==31
letter='X';
elseif ind==32
letter='Y';
elseif ind==33
letter='Z';
elseif ind==34
letter='1';
elseif ind==35
letter='2';
elseif ind==36
letter='3';
elseif ind==37 || ind==38
letter='4';
elseif ind==39
letter='5';
elseif ind==40 || ind==41 || ind==42
letter='6';
elseif ind==43
letter='7';
elseif ind==44 || ind==45
letter='8';
elseif ind==46 || ind==47 || ind==48
letter='9';
else
letter='0';
end
end