ceshi.m
来自「BP神经网络」· M 代码 · 共 40 行
M
40 行
% test one image
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('wkj2(2).dat');
wji=load('wji2(2).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
ceshitu=find(z==max(z));
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
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?