function varargout = face_GUI(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @face_GUI_OpeningFcn, ...
'gui_OutputFcn', @face_GUI_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
function face_GUI_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
function varargout = face_GUI_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
function pushbutton1_Callback(hObject, eventdata, handles)
varargout{1} = handles.output;
m=4;
s=[];
figure(1);
prefix_image='t';
fileformat='.jpg';
for i=1:m
image1= imread(strcat(prefix_image,num2str(i),fileformat));
img=rgb2gray(image1);
subplot(2,2,i);
imshow(img);
[iraw icol]=size(img);
temp=reshape(img,iraw*icol,1);
s=[s temp];
end
for i=1:m
temp=double(s(:,i));
m2=mean(temp);
st2=std(temp);
s(:,i)=((temp-m2)*60/st2)+120;
end
function pushbutton2_Callback(hObject, eventdata, handles)
varargout{1} = handles.output;
m=4;
s=[];
figure(2);
prefix_image='t';
fileformat='.jpg';
for i=1:m
image1= imread(strcat(prefix_image,num2str(i),fileformat));
img=rgb2gray(image1);
subplot(2,2,i);
imshow(img);
[iraw icol]=size(img);
temp=reshape(img',iraw*icol,1);
s=[s temp];
end
for i=1:m
temp=double(s(:,i));
m2=mean(temp);
st2=std(temp);
s(:,i)=(temp-m2)*60/st2+120;
end
for i=1:m
img=reshape(s(:,i),icol,iraw);
img=img';
subplot(2,2,i);
imshow(img);
end
m2=mean(s,2);
tmimg=uint8(m2);
img=reshape(tmimg,icol,iraw);
img=img';
function pushbutton3_Callback(hObject, eventdata, handles)
varargout{1} = handles.output;
m=4;
s=[];
figure(3);
prefix_image='t';
fileformat='.jpg';
for i=1:m
image1= imread(strcat(prefix_image,num2str(i),fileformat));
img=rgb2gray(image1);
subplot(2,2,i);
imshow(img);
[iraw icol]=size(img);
temp=reshape(img',iraw*icol,1);
s=[s temp];
end
for i=1:m
temp=double(s(:,i));
m2=mean(temp);
st2=std(temp);
s(:,i)=(temp-m2)*60/st2+120;
end
for i=1:m
img=reshape(s(:,i),icol,iraw);
img=img';
subplot(2,2,i);
imshow(img);
end
m2=mean(s,2);
tmimg=uint8(m2);
img=reshape(tmimg,icol,iraw);
img=img';
imshow(img);
dbx=[];
for i=1:m
temp=double(s(:,i));
dbx=[dbx temp];
end
A=dbx';
L=A*A';
[vv dd]=eig(L);
v=[];
d=[];
for i=1:size(vv,2)
if (dd(i,i)>1.0e-4)
v=[v vv(:,i)];
d=[d dd(i,i)];
end
end
[B index]=sort(d);
ind=zeros(size(index));
dtemp=zeros(size(index));
vtemp=zeros(size(v));
len=length(index);
for i=1:len
dtemp(i)=B(len+1-i);
ind(i)=len+1-index(i);
vtemp(:,ind(i))=v(:,i);
end
d=dtemp;
v=vtemp;
for i=1:size(v,2)
kk=v(:,i);
temp=sqrt(sum(kk.^2));
v(:,i)=v(:,i)./temp;
end
u=[];
for i=1:size(v,2)
temp=sqrt(d(i));
u=[u (dbx*v(:,i))./temp];
end
for i=1:size(u,2)
kk=u(:,i);
temp=sqrt(sum(kk.^2));
u(:,i)=u(:,i)./temp;
end
function pushbutton4_Callback(hObject, eventdata, handles)
varargout{1} = handles.output;
m=4;
s=[];
figure(4);
prefix_image='t';
fileformat='.jpg';
for i=1:m
image1= imread(strcat(prefix_image,num2str(i),fileformat));
img=rgb2gray(image1);
subplot(2,2,i);
imshow(img);
[iraw icol]=size(img);
temp=reshape(img',iraw*icol,1);
s=[s temp];
end
for i=1:m
temp=double(s(:,i));
m2=mean(temp);
st2=std(temp);
s(:,i)=(temp-m2)*60/st2+120;
end
for i=1:m
img=reshape(s(:,i),icol,iraw);
img=img';
subplot(2,2,i);
imshow(img);
end
m2=mean(s,2);
tmimg=uint8(m2);
img=reshape(tmimg,icol,iraw);
img=img';
imshow(img);
dbx=[];
for i=1:m
temp=double(s(:,i));
dbx=[dbx temp];
end
A=dbx';
L=A*A';
[vv dd]=eig(L);
v=[];
d=[];
for i=1:size(vv,2)
if (dd(i,i)>1.0e-4)
v=[v vv(:,i)];
d=[d dd(i,i)];
end
end
[B index]=sort(d);
ind=zeros(size(index));
dtemp=zeros(size(index));
vtemp=zeros(size(v));
len=length(index);
for i=1:len
dtemp(i)=B(len+1-i);
ind(i)=len+1-index(i);
vtemp(:,ind(i))=v(:,i);
end
d=dtemp;
v=vtemp;
for i=1:size(v,2)
kk=v(:,i);
temp=sqrt(sum(kk.^2));
v(:,i)=v(:,i)./temp;
end
u=[];
for i=1:size(v,2)
temp=sqrt(d(i));
u=[u (dbx*v(:,i))./temp];
end
for i=1:size(u,2)
kk=u(:,i);
temp=sqrt(sum(kk.^2));
u(:,i)=u(:,i)./temp;
end
for i=1:size(u,2)
img=reshape(u(:,i),icol,iraw);
img=img';
img=histeq(img,255);
subplot(2,2,i);
imshow(img);
drawnow;
end
omega = [];
for h=1:size(dbx,2)
WW=[];
for i=1:size(u,2)
t = u(:,i)';
WeightOfImage = dot(t,dbx(:,h)');
WW = [WW; WeightOfImage];
end
omega = [omega WW];
end
function pushbutton5_Callback(hObject, ~, handles)
function pushbutton6_Callback(hObject, eventdata, handles)
function popup_Callback(hObject, eventdata, handles)
function popup_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function popup_KeyPressFcn(hObject, eventdata, handles)