How to extract eye from a facial image?
Show older comments
Hi. I have a big problem. I wanna extract eyes from a facial image an I've written some codes for it. Unfortunately, the result is not reasonable. for the first step, I need to choose the eye's region. The result of this stage must be at the line 50, means subplot(4,4,10). But it's not acceptable and I don't have the eye region. Would any one please tell me what's the problem here?
if true
% i=imread('pic8.jpg');
subplot(4,4,1)
imshow(i)
title('original image');
iycbcr=rgb2ycbcr(i);
iycbcr = im2double(iycbcr);
subplot(4,4,2)
imshow(iycbcr)
title('YCBCR space');
y=iycbcr(:,:,1);
cb=iycbcr(:,:,2);
cr=iycbcr(:,:,3);
ccb=cb.^2;
subplot(4,4,3)
imshow(ccb)
title('CB^2');
ccr=(1-cr).^2;
subplot(4,4,4)
imshow(ccr)
title('(1-CR)^2');
cbcr=ccb./cr;
subplot(4,4,5)
imshow(cbcr)
title('CB/CR');
igray=rgb2gray(i);
subplot(4,4,6)
imshow(igray)
title('Gray space');
g=1./3;
l=g*ccb;
m=g*ccr;
n=g*cbcr;
eyemapchr=l+m+n;
subplot(4,4,7)
imshow(eyemapchr)
title('Chrom Eyemap');
J=histeq(eyemapchr);
subplot(4,4,8)
imshow(J)
title('Equalized image');
SE=strel('disk',15,8);
o=imdilate(igray,SE);
p=1+imerode(igray,SE);
eyemaplum=o./p;
subplot(4,4,9)
imshow(eyemaplum)
title('Lum Eyemap');
%the eye region
cc=and(J,eyemaplum);
subplot(4,4,10)
imshow(cc)
title('AND of Lum&Chrom');
end
Accepted Answer
More Answers (4)
Zahra kamkar
on 15 Mar 2014
0 votes
2 Comments
Image Analyst
on 16 Mar 2014
You still forgot. Please don't add "Answers" to your question. Add comments to our Answers.
Zahra kamkar
on 17 Mar 2014
Zahra kamkar
on 16 Mar 2014
0 votes
2 Comments
Image Analyst
on 16 Mar 2014
Maybe people are waiting for you to attach the image so they can run your code. Use the image icon or the paperclip icon or both.
Zahra kamkar
on 18 Mar 2014
Mohsin Raza
on 24 Sep 2020
0 votes
In this project you have to write a MATLAB code that takes the provided image “plain.jpg” as input. You have to implement Bug Eye Algorithm on the input image. Your output should be similar to the sample output image that is given below
1 Comment
Image Analyst
on 25 Sep 2020
How is this an answer to Zahra's 6 year old question? He did not provide a "plain.jpg" image. So why do you think this Bug Eye Algorithm you heard of, and suggested he use, will work with his image?
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!