I want to covert matlab as follows? If eye is detected, then move to mouth detection and display eye with bounding box. There after, If mouth is detected, then display mouth with bounding box.
1 view (last 30 days)
Show older comments
I want to covert matlab code founded from http://www.mathworks.com/matlabcentral/newsreader/view_thread/285839, as follows;
If eye is detected, then move to mouth detection and display eye with bounding box.
There after,
If mouth is detected, then display mouth with bounding box.
I found a matlab code of forming eye and mouth map from MATLAB Central as follows;
The matlab code from http://www.mathworks.com/matlabcentral/newsreader/view_thread/285839 as follows:
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);
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!