www.gusucode.com > 人脸相似匹配源码程序 > 人脸相似匹配源码程序/FaceRec/FR_GUI.m

    % FR_GUI.m

global h_axes1;
global h_axes2;

global SVM;
global Adaboost;

h_f = figure('name', '人脸识别系统');

h_textRadion = uicontrol(h_f, 'style', 'text', 'fontsize',16, 'string', '算法选择', 'position',...
    [30 280 100 50]);
SVM=uicontrol(h_f,'style','radio','position',[30 210 100 40],...
   'string','PCA+SVM','value',0,'callback',[...
   'set(Adaboost,''value'',0);'...
   'set(SVM,''value'',1);']); 
Adaboost=uicontrol(h_f,'style','radio','position',[30 140 100 40],...
   'string','PCA+Adaboost','value',1,'callback',[...
   'set(Adaboost,''value'',1);'...
   'set(SVM,''value'',0);']);

% 取得参数 C 和 gamma 的当前值,即最近一次训练所使用的值
t = dir('Mat/params.mat');
if length(t) == 0
    % 没有找到参数文件
    C = Inf;
    gamma = 1
else
    load Mat/params.mat;
end

h_axes1 = axes('parent', h_f, 'position', [0.25 0.23 0.32 0.6], 'visible', 'off');
h_axes2 = axes('parent', h_f, 'position', [0.62 0.23 0.32 0.6], 'visible', 'off');
h_btnOpen = uicontrol(h_f, 'style', 'push', 'string', '打开', 'unit', 'normalized',...
    'position', [0.32 0.1 0.18 0.1], 'callback', 'GUIOpenFaceImage');
h_btnRecg = uicontrol(h_f, 'style', 'push', 'string', '识别', 'unit', 'normalized',...
    'position', [0.67 0.1 0.18 0.1], 'callback', 'GUIRecgFaceImage');
h_btnRecg = uicontrol(h_f, 'style', 'push', 'string', '训练', 'unit', 'normalized',...
    'position', [0.32 0.83 0.18 0.1], 'callback', 'train(C, gamma)');
h_btnRecg = uicontrol(h_f, 'style', 'push', 'string', '测试', 'unit', 'normalized',...
    'position', [0.67 0.83 0.18 0.1], 'callback', 'test');