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

📄 bpnet_main.m

📁 matlab写的人工神经网络的例子
💻 M
字号:
close all
clear all

net=BPnet_creat;
while(1)
    test=input('please input the images name :','s');   % 提示输入待识别的图片的名称(输入0~9的数字即可)
    if abs(test)<abs('0') || abs(test)>abs('9')         % 输入不存在的图片名称时退出程序(需为单字符) 
        close all
        clear all
        return
    else
        x=imread(test,'bmp');               % 读入图片   
        subplot(3,1,1);
        imshow(x);
        title('待测样本原始图');
        x1=imnoise(x,'gaussian',0,0.02);   % 给图片加噪声
        subplot(3,1,2);
        imshow(x1);                         % 显示加噪声的图片
        title('待测样本加噪图');

        for m=0:31                          % 按列抽取x,形成测试向量
            p(m*32+1:(m+1)*32,1)=double(x1(1:32,m+1));
        end

        [y,Pf,Af]=sim(net,p);              % 对网络仿真
        disp(strcat('The recogrized num is:    ',num2str(y)));
        y=round(y);                         % 输出识别的结果
        switch y
            case  0
                subplot(3,1,3);
                x2=imread('0.bmp','bmp');
                imshow(x2);
                title('识别出的数');
            case  1
                subplot(3,1,3);
                x2=imread('1.bmp','bmp');
                imshow(x2);
                title('识别出的数');
            case  2
                subplot(3,1,3);
                x2=imread('2.bmp','bmp');
                imshow(x2);
                title('识别出的数');
            case  3
                subplot(3,1,3);
                x2=imread('3.bmp','bmp');
                imshow(x2);
                title('识别出的数');
            case  4
                subplot(3,1,3);
                x2=imread('4.bmp','bmp');
                imshow(x2);
                title('识别出的数');
            case  5
                subplot(3,1,3);
                x2=imread('5.bmp','bmp');
                imshow(x2);
                title('识别出的数');
            case  6
                subplot(3,1,3);
                x2=imread('6.bmp','bmp');
                imshow(x2);
                title('识别出的数');
            case  7
                subplot(3,1,3);
                x2=imread('7.bmp','bmp');
                imshow(x2);
                title('识别出的数');
            case  8
                subplot(3,1,3);
                x2=imread('8.bmp','bmp');
                imshow(x2);
                title('识别出的数');
            case  9
                subplot(3,1,3);
                x2=imread('9.bmp','bmp');
                imshow(x2);
                title('识别出的数');     
        end
    end     
end    

⌨️ 快捷键说明

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