test_main.m

来自「face recognition test source code」· M 代码 · 共 29 行

M
29
字号
clc;close all;clear all;
deletedatabase('my_database');       % Delete "my_database", if it exists. If input database 
                                     % does not exist no action is performed

img = imread('s1_1.pgm');               % Load an image into workspace
ID  = 1;                                % ID is a progressive, integer number
add2database(img,ID,'my_database');     % Add this image for person #1 to database "my_database"

img = imread('s2_1.pgm');              % Add another image to the database ("my_database" DB)
ID  = 2;                               % This second image is person #2
add2database(img,ID,'my_database');

img = imread('s3_1.pgm');              % Add another image to the database ("my_database" DB)
ID  = 3;                               % This third image is person #3
add2database(img,ID,'my_database');

img = imread('s1_2.pgm');              % Add another image to the database ("my_database" DB)
ID  = 1;                               % For this fourth image added to DB I have to use ID #1.
add2database(img,ID,'my_database');

% Now database of known faces is ready. You can add other images, of
% course, to make the recognition process more robust.

img = imread('s1_3.pgm');                       % Load an unknown image
ID = recognitionVSdatabase(img,'my_database');  % Face identification: it is necessary to specify
                                                % input image and the database of "known" faces

disp('Recognized ID');
disp(ID);

⌨️ 快捷键说明

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