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

📄 main.m

📁 这个也是关于人脸检测的程序
💻 M
字号:
% Version : 4.1
% Author  : Omid Bonakdar Sakhi

clear all;
clc;
close all;

% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% create_gabor is a s script . it's purpose is to craete a file 
% create_gabor 是 a s 手写体。 它目的有对 craete 一个文件吗
% with name 'gabor.mat'.  % 藉由名字 'gabor.mat'.
% This file contains a cell array matrix with name 'G'
% 这个文件包含一个细胞排列点阵式与名字 'G'
% and 'G' has 40 32x32 matrixes coresponding to Gabor filter
% 而且 'G' 有对 Gabor 过滤器的 4032 x 32个点阵式 coresponding
% in frequency domain  % 在频率领域中
if ~exist('gabor.mat','file')
    fprintf ('Creating 40 Gabor Filters ...');
    create_gabor;
end
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% createffnn create a feedforward neural network with 100 neurons
% createffnn 用 100个神经原产生一个前馈类神经网路
% in input layer and one neuron in output layers
% 在输入层和一输出的神经原层
% the network input is a 27x18 window of the picture in vector
% 网络输入在矢量中是这 27 x 照片的 18扇窗户
% form . it's purpose is to determine if the window is a face or not
% 形式。 它有目的将决定如果窗户是一个脸
% the output of the network is close to 0.9 for a face and close to
% 网络的输出是一个脸的接近 0.9 和结束到
% -0.9 for a non-face  %-0.9 为一个非脸
if exist('net.mat','file')
    load net;
else
    createffnn
end
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% loadimages prepare images in face and non-face folders
% loadimages 在脸中准备图像和非脸文件夹
% for network traning phase. % 因为网络 traning 状态。
% See the source for more information % 为更多数据见到来源
if exist('imgdb.mat','file')
    load imgdb;
else
    IMGDB = loadimages;
end
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

while (1==1)
    
    choice=menu('Face Detection',...
                'Create Database',...
                'Initialize Network',...
                'Train Network',...
                'Image Scanner',...
                'Exit');
            
    if (choice ==1)
        IMGDB = loadimages;
    end
    if (choice == 2)
        createffnn
    end    
      
    if (choice == 3)
        % trainnet is a fuction which train the network  
        % trainnet 是 fuction 火车网络
        net = trainnet(net,IMGDB);
    end

    if (choice == 4)
        [file_name file_path] = uigetfile ('*.jpg');
        im = imread ([file_path,file_name]);
        % if the input image happenes to be an RGB image
         % 如果那输入图像碰巧是一个 RGB 图像
        % try-end will convert it to gray image  % 尝试-结束意志皈依者它到灰色图像
        try
            im = rgb2gray(im);
        end
        % imscan is a function which scan the whole photo for faces
         % imscan 是一个功能扫描那全部相片为脸
        % im_out is the output image of the function
         % im_out 是功能的输出图像
        % with green rectangles across the faces    % 藉由绿色的长方形横过那脸
        im_out = imscan (net,im);
        figure;imshow(im_out,'notruesize');
    end

    if (choice == 5)
        clear all;
        clc;
        close all;
        return;
    end    
end

⌨️ 快捷键说明

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