-
Notifications
You must be signed in to change notification settings - Fork 0
/
Baybayin_letter_revised_segueway_Baybayin_only.m
156 lines (132 loc) · 3.45 KB
/
Baybayin_letter_revised_segueway_Baybayin_only.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
%======================================================================%
%Note: %
%This is a subfunction from the Baybayin SVM-OCR System %
%(Baybayin_only.m) for classifying one component Baybayin characters %
% ---------------------------------------------------------------------%
%Mdl= SVM Model for recognizing baybayin script (56x56)
%input= 56x56 binarized Baybayin character
function P=Baybayin_letter_revised_segueway_Baybayin_only(Mdl,input)
%List of Binary classifiers which will be use for
%reclassification of confusive Baybayin characters
Confuselist={'AVSMa_00225.mat','KaVSEI_00100.mat','smile.mat',...
'HaVSSA_00050.mat','LaVSTa_00100.mat','PaVSYa_00550.mat'};
Letter1=feature_vector_extractor(input); %feature vector extraction
%Default Baybayin character classification
[~,~,~,Posterior]=predict(Mdl,Letter1);
[P, Label1]=max(Posterior);
if Label1==1
Check01=load(Confuselist{1});
Check02=struct2cell(Check01);
Check03=Check02{1};
[lab,~]=predict(Check03,Letter1);
if lab==1
P='a';
elseif lab==-1
P='ma';
end
elseif Label1==2
P='ba';
elseif Label1==3
Check01=load(Confuselist{2});
Check02=struct2cell(Check01);
Check03=Check02{1};
[lab,~]=predict(Check03,Letter1);
if lab==1
P='ka';
elseif lab==-1
P='i';
end
elseif Label1==4
P='da';
elseif Label1==5
Check01=load(Confuselist{2});
Check02=struct2cell(Check01);
Check03=Check02{1};
[lab,~]=predict(Check03,Letter1);
if lab==1
P='ka';
elseif lab==-1
P='i';
end
elseif Label1==6
P='ga';
elseif Label1==7
Check01=load(Confuselist{4});
Check02=struct2cell(Check01);
Check03=Check02{1};
[lab,~]=predict(Check03,Letter1);
if lab==1
P='ha';
elseif lab==-1
P='sa';
end
elseif Label1==8
Check01=load(Confuselist{5});
Check02=struct2cell(Check01);
Check03=Check02{1};
[lab,~]=predict(Check03,Letter1);
if lab==1
P='la';
elseif lab==-1
P='ta';
end
elseif Label1==9
Check01=load(Confuselist{1});
Check02=struct2cell(Check01);
Check03=Check02{1};
[lab,~]=predict(Check03,Letter1);
if lab==1
P='a';
elseif lab==-1
P='ma';
end
elseif Label1==10
P='na';
elseif Label1==11
P='nga';
elseif Label1==12
P='u';
elseif Label1==13
Check01=load(Confuselist{6});
Check02=struct2cell(Check01);
Check03=Check02{1};
[lab,~]=predict(Check03,Letter1);
if lab==1
P='pa';
elseif lab==-1
P='ya';
end
elseif Label1==14
Check01=load(Confuselist{4});
Check02=struct2cell(Check01);
Check03=Check02{1};
[lab,~]=predict(Check03,Letter1);
if lab==1
P='ha';
elseif lab==-1
P='sa';
end
elseif Label1==15
Check01=load(Confuselist{5});
Check02=struct2cell(Check01);
Check03=Check02{1};
[lab,~]=predict(Check03,Letter1);
if lab==1
P='la';
elseif lab==-1
P='ta';
end
elseif Label1==16
P='wa';
elseif Label1==17
Check01=load(Confuselist{6});
Check02=struct2cell(Check01);
Check03=Check02{1};
[lab,~]=predict(Check03,Letter1);
if lab==1
P='pa';
elseif lab==-1
P='ya';
end
end
end