📄 ceshi.asv
字号:
clear
clc
str1=input('please enter the testing number: ');
%str1='0';
str1=int2str(str1);
%ceshituname=imread('0-9.bmp');
str2=input('please enter the testing picture: ');
%ceshituname=imread('0-9.bmp');
str2=int2str(str2);
ceshituname=imread(strcat(str1,'-',str2,'.bmp'));
ceshitu2bw=im2bw(ceshituname);
ceshituvector=getfeature(ceshitu2bw);
wkj=load('wkj1.dat');
wji=load('wji1.dat');
netj=wji*ceshituvector; %netj is 14*1
yj=f(netj); %yj is 14*1
netk=wkj*yj; %netk is 10*1
z=f(netk) %z is 1*10
z=round(z);
%if length(result)>1 %error
%ceshitu=find(z==max(z))
ceshitu=find(z==1)
ceshitu=int2str(ceshitu);
if ceshitu=='10'
ceshitu='0';
end
if ceshitu==str1
figure(1);
imshow(ceshituname);
ceshitunamestr=strcat(ceshitu,'.jpg');
figure(2);
imshow(ceshitunamestr);
end
right=0;
righttu=[];
rightv=[0 0];
wrong=0;
test=0;
id=[];
for j=0:9
str1=int2str(j);
for k=1:10
str2=int2str(k);
% for l=0:9
% str3=int2str(l);
testfnamestr=strcat(str1,'-',str2,'.bmp');
testfname=imread(testfnamestr);
testfname2bw=im2bw(testfname);
testinvector=getfeature(testfname2bw);
netj=wji*testinvector; %netj is 14*1
yj=f(netj); %yj is 14*1
netk=wkj*yj; %netk is 10*1
z=f(netk); %z is 1*10
%z=round(z);
%if length(result)>1 %error
ceshitu=find(z==max(z));
ceshitu=int2str(ceshitu);
if ceshitu=='10'
ceshitu='0';
end
if ceshitu==str1
rightv=[j,k];
righttu=[righttu;rightv];
right=right+1;
else
wrong=wrong+1;
end
test=test+1;
% end
end
end
test
hold off;
right
wrong
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -