⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 handwritings.m

📁 支持向量机的手写数字识别,绝对原创,识别率100%
💻 M
字号:
function features = HandWritings(f,para)
  
if ndims(f) == 3
   f = rgb2gray(f);
end

[Row,Col] = find(f == 0);
minCol = min(Col);
maxCol = max(Col);
minRow = min(Row);
maxRow = max(Row);
Width = maxCol - minCol;
Hight = maxRow - minRow;
WidthStep = floor(Width/5);
HightStep = floor(Hight/5);
startPoints = [];
for t = 1 : 25
    startPoints  = [startPoints;[minRow,minCol] + [floor((t - 1)/5)*HightStep , mod(t - 1,5)*WidthStep]];
end

fs = {};

for t = 1 : 25
    fs  = [fs,f(startPoints(t,1):startPoints(t,1)+HightStep, startPoints(t,2):startPoints(t,2)+WidthStep)];
end

if nargin == 2
   for t = 1:25
       subplot(5,5,t);
       image(fs{t});
       axis off;
   end    
end

features = [];
SumNum = WidthStep * HightStep;
for t = 1:25
    Nums = sum(sum(fs{t}==0))/SumNum;
    features = [features,Nums];
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -