?? recognition.m
字號:
function [Numeral]=Recognition(StrokeTop,StrokeLeft,StrokeRight,StrokeBottom,Comp)
% 采用四邊的輪廓結(jié)構(gòu)特征和筆劃統(tǒng)計(jì)(僅針對 0 和 8)識別殘缺數(shù)字
% Comp 是用于識別 0和8 的底部補(bǔ)充信息
StrT='T';
StrL='T';
StrR='T';
StrB='T';
RStr='T'; % 用于保存識別出的數(shù)字
[temp XT]=size(StrokeTop);
[temp XL]=size(StrokeLeft);
[temp XR]=size(StrokeRight);
%[temp XB]=size(StrokeBottom);
for Ti=2:XT
if (StrokeTop(Ti)=='C')
if ((XL==2)&&(XR==2))
if ((Comp>=3)||((StrokeBottom(2)~='C')&&(StrokeLeft(2)=='C')&&(StrokeRight(2)=='C')))
RStr='8';
else
RStr='0';
end
else if ((StrokeLeft(XL)=='L')&&(StrokeLeft(XL-1)=='P')&&(StrokeLeft(2)~='C'))
RStr='2';
else if ((StrokeLeft(2)=='C')&&(XL>=3)&&(StrokeLeft(3)=='P'))
RStr='9';
else if (XL>2)
for Li=2:XL
if (StrokeLeft(Li)=='P')
RStr='3';
end
end
else if (XL==2)
for Ri=2:XR-1
if (StrokeRight(Ri)=='P')
RStr='6';
end
end
end
end
end
end
end
else if (StrokeTop(Ti)=='V') % Top
if ((XR==2)&&(StrokeRight(2)=='C')) % 數(shù)字 3 右端只有一個(gè)結(jié)構(gòu)
RStr='3';
else if ((XR==2)&&((StrokeLeft(2)=='P')||(StrokeLeft(3)=='P')||(StrokeLeft(XL)=='V')))
RStr='7';
else if (XR>2)
for Ri=2:XR
if (StrokeRight(Ri)=='P')
RStr='5';
end
end
end
end
end
else if ((StrokeTop(Ti)=='L')) % Top
if ((StrokeRight(XR)=='V')&&(XR<=2))
RStr='4';
else
for Ri=2:XR
if ((StrokeRight(Ri)=='L')||(StrokeRight(Ri)=='C'))
RStr='6';
end
end
end
end
end %對應(yīng)于'V'
end % 對應(yīng)于'C'
end % 對應(yīng)于第一個(gè) for 循環(huán)
Numeral=RStr;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -