From: Rabab Alkasah on
I have this code and I want to extract the eyes' area in the detected face area, please could you help me?
Note that this code is based on the methodolgy of the paper that called face detection in color images (2001) , I have applied section 2.2.1 and 2.2.2 but I am still strugling in applying section 2.2.3.
you can find it here: http://www.megafileupload.com/en/file/246328/10-1-1-73-3628-1--pdf.html
This is the code:
I=imread('c:\darwin\lip tracking\faceDetection\face.jpg');
%I=imread(frame);
EyeMap = rgb2ycbcr(I);
temp1=0;
temp2=0;
%Q = rgb2gray(I);
%imshow(EyeMap)
[m n l]=size(EyeMap);
%Finding EyeMapC
y = double(EyeMap(:,:,1));
Cb = double(EyeMap(:,:,2));
Cr = double(EyeMap(:,:,3));
Z=Cr;


Q = Cb.^2;
R = (255-Cr).^2;
G = Cb./Cr;
CrCb = Cr./Cb;

%Eye Map for Crominance
EyeC=(Q+R+G)/3;
CRS = Cr.^2;

ssCRS = sum(sum(CRS));
ssCrCb=sum(sum(CrCb));
eta = 0.95 * ssCRS/ssCrCb;
x= CRS - eta * Cr./Cb;
MM = CRS.*x.*x;

SE=strel('disk',4) ;
UP=imdilate(y,SE);
Down=imerode(y,SE);
EyeY= UP./(Down+1);
EyeMap=EyeY.*EyeC;

figure;
subplot(1,4,1), imagesc(I);title ('Face');axis off;
subplot(1,4,2), imagesc(Q);title ('Cb^2');axis off;
subplot(1,4,3), imagesc(R);title ('(Cr-complement)^2');axis off;
subplot(1,4,4), imagesc(EyeC);title ('Eye-Map-C'); axis off;
colormap(gray);
figure;
subplot(1,4,1), imagesc(UP);title ('Dilation'); axis off;
subplot(1,4,2), imagesc(Down);title ('Erotion'); axis off;
subplot(1,4,3), imagesc(EyeY);title ('EyeY'); axis off;
subplot(1,4,4), imagesc(EyeMap);title ('EyeMap'); axis off;
%colormap(gray);
%figure
%imagesc(MM);title ('MouthMap');
colormap(gray);