Beruflich Dokumente
Kultur Dokumente
REVIEW 3
FINAL REPORT
1 Abstract 1
2 Objectives 2
3 Literature Review
4 Requirements -
5 Invention Details
MODULES:
1. Create database
2. Eigen face core
3. Eigen face test
4. Face recognition
5. Main
Objectives:
Our primary goal is to help the lecturers, improve and organize the process of
track and manage student attendance and absenteeism. Additionally, we seek to:
Literature Review
For our project we got motivation by the research carried out by the following
people and their published papers:
“Eigenfaces for recognition’’ (Mathew Turk and Alex Pentland) [1], here they
have developed a near-real time computer system that can locate and track a
subject’s head, and then recognize the person by comparing characteristics of
the face to those of known individuals. The computational approach taken in
this system is motivated by both physiology and information theory, as well as
by the practical requirements of near-real time performance and accuracy. This
approach treats the face recognition problem as an intrinsically two-dimensional
recognition problem rather than requiring recovery of threedimensional
geometry, taking advantage of the fact that these faces are normally upright and
thus may be described by a small set of two-dimensional characteristic views.
Their experiments show that the eigenface technique can be made to perform at
very high accuracy, although with a substantial “unknown “rejection rate and
thus potentially well suited to these applications. The future scope of this
project was-in addition to recognizing face, to use eigenface analysis to
determine the gender of the subject and to interpret facial expressions.
National Status:
1) Face Recognition Techniques - An evaluation Study
(Department of Management Information System, Applied
Science University,)
S(B)*W(LDA) = S(W)*W(LDA) *D
International Status:
1) SPARSE REPRESENTATION THEORY AND ITS APPLICATIONS FOR
FACE RECOGNITION
PC
WEB CAM
Software requirements:
MATLAB
INVENTION DETAILS
It is very useful in protected zone while many pupils are entering and exiting.
For e.g., Take a bank while entering it takes the data from the user and the
cameras installed will takes the photos particulary the faces of the user and
combines with their user names.
Summary of Invention:
We use open CV with python .It detect the faces and combines with the ID
given by names and taken into database .Afterwards while recognizing the face
it display the name
Architecture of project:
BLOCK DIAGRAM:
IMAGE PROCESSING
START
CAPTURE
IMAGE
FACE DETECTION
AND CROPPING
FACE RECOGNITION
USING EIGEN
VALUES
STORED
RECOGNITION
ENTRIES
Detailed Description of the Invention:
➢ We use MAT LAB and this detects the faces and store in the database .Our
duty is to give the ID’s for the corresponding image and the names.
➢ While it about to sign in process it checks the image in the database whether
it is present or not and gives
➢ The result our name with our image if not it displays “Not an authorized
user please sign up”.
CODE:
CREATE DATABASE
function T = CreateDatabase(TrainDatabasePath)
% Align a set of face images (the training set T1, T2, ... , TM )
%
% Description: This function reshapes all 2D images of the training
database
% into 1D column vectors. Then, it puts these 1D column vectors in a row to
% construct 2D matrix 'T'.
%
%
% Argument: TrainDatabasePath - Path of the training database
%
% Returns: T - A 2D matrix, containing all 1D
image vectors.
% Suppose all P images in the
training database
% have the same size of MxN. So the
length of 1D
% column vectors is MN and 'T' will
be a MNxP 2D matrix.
%
% See also: STRCMP, STRCAT, RESHAPE
for i = 1:size(TrainFiles,1)
if
not(strcmp(TrainFiles(i).name,'.')|strcmp(TrainFiles(i).name,'..')|strcmp(T
rainFiles(i).name,'Thumbs.db'))
Train_Number = Train_Number + 1; % Number of all images in the
training database
end
end
%%%%%%%%%%%%%%%%%%%%%%%% Construction of 2D matrix from 1D image vectors
T = [];
for i = 1 : Train_Number
img = imread(str);
img = rgb2gray(img);
EIGEN FACECORE
function [m, A, Eigenfaces] = EigenfaceCore(T)
% Use Principle Component Analysis (PCA) to determine the most
discriminating features between images of faces.
%
% Description: This function gets a 2D matrix, containing all training
image vectors
% and returns 3 outputs which are extracted from training database.
%
% Argument: T - A 2D matrix, containing all 1D
image vectors.
% Suppose all P images in the
training database
% have the same size of MxN. So the
length of 1D
% column vectors is M*N and 'T'
will be a MNxP 2D matrix.
%
% Returns: m - (M*Nx1) Mean of the training
database
% Eigenfaces - (M*Nx(P-1)) Eigen vectors of the
covariance matrix of the training database
% A - (M*NxP) Matrix of centered image
vectors
%
% See also: EIG
L_eig_vec = [];
for i = 1 : size(V,2)
if( D(i,i)>1 )
L_eig_vec = [L_eig_vec V(:,i)];
end
end
L_eig_vec = [];
for i = 1 : size(V,2)
if( D(i,i)>1 )
L_eig_vec = [L_eig_vec V(:,i)];
end
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Outputs from this function are returned to the command line.
function varargout = MAIN_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function FILE_Callback(hObject, eventdata, handles)
% hObject handle to FILE (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function OPEN_Callback(hObject, eventdata, handles)
% hObject handle to OPEN (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[fn, pn]=uigetfile('*.jpg;*.png');
a=[pn fn];
b=imread(a);
handles.b=b;
axes(handles.axes5);
imshow(b);
guidata(hObject,handles);
% --------------------------------------------------------------------
function Untitled_3_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function ON_Callback(hObject, eventdata, handles)
% hObject handle to ON (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
mkdir('E:\New
folder\facerecattendencesystem\facerecattendencesystem\TestDatabase');
axes(handles.axes5);
vid = videoinput('winvideo',1);
handles.vid=vid;
vidRes = get(vid, 'VideoResolution');
nBands = get(vid, 'NumberOfBands');
hImage = image( zeros(vidRes(2), vidRes(1), nBands) );
preview(vid,hImage);
img = getsnapshot(vid);
axes(handles.axes6);
imshow(img);
guidata(hObject,handles);
FDetect=vision.CascadeObjectDetector('FrontalFaceCART');
BB=step(FDetect,img);
axes(handles.axes7);
imshow(img);
hold on
for i=1:size(BB,1)
rectangle('position',BB(i,:),'Linewidth',5,'Linestyle','-
','Edgecolor','r');
end
hold off
N=size(BB,1);
handles.N=N;
counter=1;
for i=1:N
face=imcrop(img,BB(i,:));
savenam = strcat('E:\New
folder\facerecattendencesystem\facerecattendencesystem\TestDatabase\'
,num2str(counter), '.jpg'); %this is where and what your image will be
saved
baseDir = 'E:\New
folder\facerecattendencesystem\facerecattendencesystem\TestDatabase\';
% baseName = 'image_';
newName = [baseDir num2str(counter) '.jpg'];
handles.face=face;
while exist(newName,'file')
counter = counter + 1;
newName = [baseDir num2str(counter) '.jpg'];
end
fac=imresize(face,[240,320]);
imwrite(fac,newName);
axes(eval(['handles.axes', num2str(i)]));
imshow(face);
guidata(hObject,handles);
pause(5);
end
% --------------------------------------------------------------------
function OFF_Callback(hObject, eventdata, handles)
% hObject handle to OFF (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
off=handles.vid;
delete(off);
% --------------------------------------------------------------------
function EXIT_Callback(hObject, eventdata, handles)
% hObject handle to EXIT (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close;
case 2
strmsg1 = 'The Person is Recognised. ';
msg = [strmsg1 ' '];
msgbox(msg);
sd=strcat('D',num2str(j));
% se=strcat('E',num2str(j));
% dt = datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM');
% dt=char(dt);
% xlswrite('java.xlsx',dt,'Sheet1',se);
xlswrite('java.xlsx','2','Sheet1',sd);
case 3
strmsg1 = 'The Person is Recognised.';
msg = [strmsg1 ' '];
msgbox(msg);
sd=strcat('D',num2str(j));
% se=strcat('E',num2str(j));
% dt = datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM');
% dt=char(dt);
% xlswrite('java.xlsx',dt,'Sheet1',se);
xlswrite('java.xlsx','3','Sheet1',sd);
case 4
strmsg1 = 'The Person is Recognised. ';
msg = [strmsg1 ' '];
msgbox(msg);
sd=strcat('D',num2str(j));
% se=strcat('E',num2str(j));
% dt = datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM');
% dt=char(dt);
% xlswrite('java.xlsx',dt,'Sheet1',se);
xlswrite('java.xlsx','4','Sheet1',sd);
case 5
strmsg1 = 'The Person is Recognised. ';
msg = [strmsg1 ' '];
msgbox(msg);
sd=strcat('D',num2str(j));
% se=strcat('E',num2str(j));
% dt = datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM');
% dt=char(dt);
% xlswrite('java.xlsx',dt,'Sheet1',se);
xlswrite('java.xlsx','5','Sheet1',sd);
case 6
strmsg1 = 'The Person is Recognised.';
msg = [strmsg1 ' '];
msgbox(msg);
sd=strcat('D',num2str(j));
% se=strcat('E',num2str(j));
% dt = datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM');
% dt=char(dt);
% xlswrite('java.xlsx',dt,'Sheet1',se);
xlswrite('java.xlsx','6','Sheet1',sd);
% case 7
% strmsg1 = 'The recognised person is ';
% msg = [strmsg1 'SOORAJ'];
% msgbox(msg);
% sd=strcat('D',num2str(j));
% % se=strcat('E',num2str(j));
% % dt = datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM');
% % dt=char(dt);
% % xlswrite('java.xlsx',dt,'Sheet1',se);
% xlswrite('java.xlsx','1','Sheet1',sd);
% case 8
% strmsg1 = 'The recognised person is ';
% msg = [strmsg1 'SOORAJ'];
% msgbox(msg);
% sd=strcat('D',num2str(j));
% % se=strcat('E',num2str(j));
% % dt = datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM');
% % dt=char(dt);
% % xlswrite('java.xlsx',dt,'Sheet1',se);
% xlswrite('java.xlsx','1','Sheet1',sd);
%
% case 9
% strmsg1 = 'The recognised person is ';
% msg = [strmsg1 'SOORAJ'];
% msgbox(msg);
% sd=strcat('D',num2str(j));
% % se=strcat('E',num2str(j));
% % dt = datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM');
% % dt=char(dt);
% % xlswrite('java.xlsx',dt,'Sheet1',se);
% xlswrite('java.xlsx','1','Sheet1',sd);
% case 10
% strmsg1 = 'The recognised person is ';
% msg = [strmsg1 'ramya'];
% msgbox(msg);
% sd=strcat('D',num2str(j));
% % se=strcat('E',num2str(j));
% % dt = datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM');
% % dt=char(dt);
% % xlswrite('java.xlsx',dt,'Sheet1',se);
% xlswrite('java.xlsx','1','Sheet1',sd);
%
% case 11
% strmsg1 = 'The recognised person is ';
% msg = [strmsg1 'ramya'];
% msgbox(msg);
% sd=strcat('D',num2str(j));
% % se=strcat('E',num2str(j));
% % dt = datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM');
% % dt=char(dt);
% % xlswrite('java.xlsx',dt,'Sheet1',se);
% xlswrite('java.xlsx','1','Sheet1',sd);
%
% case 12
% strmsg1 = 'The recognised person is ';
% msg = [strmsg1 'ramya'];
% msgbox(msg);
% sd=strcat('D',num2str(j));
% % se=strcat('E',num2str(j));
% % dt = datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM');
% % dt=char(dt);
% % xlswrite('java.xlsx',dt,'Sheet1',se);
% xlswrite('java.xlsx','1','Sheet1',sd);
% case 13
% strmsg1 = 'The recognised person is ';
% msg = [strmsg1 'shyam'];
% msgbox(msg);
% sd=strcat('D',num2str(j));
% % se=strcat('E',num2str(j));
% % dt = datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM');
% % dt=char(dt);
% % xlswrite('java.xlsx',dt,'Sheet1',se);
% xlswrite('java.xlsx','1','Sheet1',sd);
%
% case 14
% strmsg1 = 'The recognised person is ';
% msg = [strmsg1 'shyam'];
% msgbox(msg);
% sd=strcat('D',num2str(j));
% % se=strcat('E',num2str(j));
% % dt = datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM');
% % dt=char(dt);
% % xlswrite('java.xlsx',dt,'Sheet1',se);
% xlswrite('java.xlsx','1','Sheet1',sd);
%
% case 15
% strmsg1 = 'The recognised person is ';
% msg = [strmsg1 'shyam'];
% msgbox(msg);
% sd=strcat('D',num2str(j));
% % se=strcat('E',num2str(j));
% % dt = datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM');
% % dt=char(dt);
% % xlswrite('java.xlsx',dt,'Sheet1',se);
% xlswrite('java.xlsx','1','Sheet1',sd);
end
end
% --------------------------------------------------------------------
function TESTON_Callback(hObject, eventdata, handles)
% hObject handle to TESTON (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
axes(handles.axes5);
vid = videoinput('winvideo',1);
handles.vid=vid;
vidRes = get(vid, 'VideoResolution');
nBands = get(vid, 'NumberOfBands');
hImage = image( zeros(vidRes(2), vidRes(1), nBands) );
preview(vid,hImage);
guidata(hObject,handles);
% --------------------------------------------------------------------
function TESTOFF_Callback(hObject, eventdata, handles)
% hObject handle to TESTOFF (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
off=handles.vid;
delete(off);
% --------------------------------------------------------------------
function PREVIEW_Callback(hObject, eventdata, handles)
% hObject handle to PREVIEW (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function ADDPHOTO_Callback(hObject, eventdata, handles)
% hObject handle to ADDPHOTO (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function ADD_Callback(hObject, eventdata, handles)
% hObject handle to ADD (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
mkdir('E:\New folder\TrainDatabase');
for ind=1:3
axes(handles.axes5);
vid = videoinput('winvideo',1);
handles.vid=vid;
vidRes = get(vid, 'VideoResolution');
nBands = get(vid, 'NumberOfBands');
hImage = image( zeros(vidRes(2), vidRes(1), nBands) );
preview(vid,hImage);
img = getsnapshot(vid);
axes(handles.axes6);
imshow(img);
guidata(hObject,handles);
FDetect=vision.CascadeObjectDetector('FrontalFaceCART');
%htextinsface = vision.TextInserter('Text', 'face : %2d', 'Location',
[5 2],'Font', 'Courier New','FontSize', 14);
BB=step(FDetect,img);
axes(handles.axes7);
imshow(img);
hold on
for i=1:size(BB,1)
rectangle('position',BB(i,:),'Linewidth',5,'Linestyle','-
','Edgecolor','r');
end
hold off
N=size(BB,1);
handles.N=N;
counter=1;
for i=1:N
face=imcrop(img,BB(i,:));
savenam = strcat('E:\New
folder\facerecattendencesystem\facerecattendencesystem\TrainDatabase\'
,num2str(counter), '.jpg'); %this is where and what your image will be
saved
baseDir = 'E:\New
folder\facerecattendencesystem\facerecattendencesystem\TrainDatabase\';
% baseName = 'image_';
newName = [baseDir num2str(counter) '.jpg'];
handles.face=face;
while exist(newName,'file')
counter = counter + 1;
newName = [baseDir num2str(counter) '.jpg'];
end
fac=imresize(face,[240,320]);
imwrite(fac,newName);
%axes(handles.axes14);
axes(eval(['handles.axes', num2str(i)]));
imshow(face);
guidata(hObject,handles);
pause(2);
end
delete(vid);
end
% --------------------------------------------------------------------
function REMOVE_Callback(hObject, eventdata, handles)
% hObject handle to REMOVE (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
rmdir('E:\New
folder\facerecattendencesystem\facerecattendencesystem\TestDatabase','s')
RECOGNITION
function [OutputName,Recognized_index] = Recognition(TestImage, m, A,
Eigenfaces)
% Recognizing step....
%
% Description: This function compares two faces by projecting the images
into facespace and
% measuring the Euclidean distance between them.
%
% Argument: TestImage - Path of the input test image
%
% m - (M*Nx1) Mean of the training
% database, which is output of
'EigenfaceCore' function.
%
% Eigenfaces - (M*Nx(P-1)) Eigen vectors of the
% covariance matrix of the training
% database, which is output of
'EigenfaceCore' function.
%
% A - (M*NxP) Matrix of centered image
% vectors, which is output of
'EigenfaceCore' function.
%
% Returns: OutputName - Name of the recognized image in
the training database.
%
% See also: RESHAPE, STRCAT
ProjectedImages = [];
Train_Number = size(Eigenfaces,2);
for i = 1 : Train_Number
temp = Eigenfaces'*A(:,i); % Projection of centered images into
facespace
ProjectedImages = [ProjectedImages temp];
end
Euc_dist = [];
for i = 1 : Train_Number
q = ProjectedImages(:,i);
temp = ( norm( ProjectedTestImage - q ) )^2;
Euc_dist = [Euc_dist temp];
end