function Face=getface(A,i,j,tag)
% Summary: get the face i,j from the database \data\face.bmp
% Synopsis: Face=getface(A,i,j,tag)
% i denotes the row number between 1 and 40
% j denotes the column number between 1and 10
% tag:0 for 56x46 facial image, 1 for 28x23 facial image

if nargin ==4
    if tag==1
        Face=A(29*(i-1)+1:29*i-1,24*(j-1)+1:24*j-1);
    else
        if i > 40 | j > 10 
            error('You input the wrong number ! (1~40),(1~10)');
        else   
            if i  <= 20
                Face=A(1+57*(i-1):1+57*(i-1)+55,1+47*(j-1):1+47*(j-1)+45);
            else
                Face=A(1+57*(i-21):1+57*(i-21)+55,472+47*(j-1):472+47*(j-1)+45);
            end
        end
    end
end

%imshow(Face);