How To Detect The Eye of this image?

조회 수: 2 (최근 30일)
john john
john john 2013년 1월 26일
댓글: Image Analyst 2015년 5월 13일
Hi guys I am doing eye tracking in real time in snapshop i need help with image processing, any best suggestion to track the eye and crop it automatically?
this is my image
1. read image
2. convert rgb2gray
3. filter
4. how do I automatically track the eye?
5. how do I crop that region
  댓글 수: 1
anjana sharma
anjana sharma 2013년 8월 14일
Hi John, I m also doing my work on detecting eye in any entered image.I hve tried but the cropping and coordinates are well for one image but not general for any other image.I m tryng something with horizontal projection but not able to detect the coordinates with high intensity i.e eyes in the upper region of the image.if u pls getsomethng pls help me out. i m already stuck/???

댓글을 달려면 로그인하십시오.

답변 (3개)

Image Analyst
Image Analyst 2013년 1월 26일
What is snapshop? This is a MATLAB forum only.
  댓글 수: 2
john john
john john 2013년 1월 26일
ops snapshot what i mean sir..
Image Analyst
Image Analyst 2013년 1월 26일
You need to find an iris locating algorithm. Check the File Exchange and Vision Bib for suitable algorithms - we don't provide that kind of major research for you here. Once you have code and need some help on things like syntax, error messages, etc. then that's the kind of thing we mostly provide help on.

댓글을 달려면 로그인하십시오.


Pasupathi T
Pasupathi T 2013년 5월 27일
편집: Walter Roberson 2014년 2월 21일
hai Image Analyst,
i am doing project using MATALB for drowsiness detection of driver..so far i have done something..
1.Image is captured in real time thru webcam
2.Images are converted into frames
3. and then stored in some location
i am struggling in detecting eyes and finding drowsy...herewith i have attached my code... please correct it and help me to get the output
clc ; % clearing the command window
%%%%%%%%%%%
n = input(' Enter the number of photos to be taken: ');
intervel = input(' Enter the time(seconds) gap between succeessive photos: ');
photosave = input(' Do you want to save the files(y/n): ','s');
disp('Please wait...');
%%%%%%%%%%
outputFolder = fullfile(cd, 'frames');
if ~exist(outputFolder, 'dir')
mkdir(outputFolder);
end
%%%%%%%%%%
obj = videoinput('winvideo',1);
preview(obj);
disp('Press Enter to start after webcam initialization.');
pause;
disp('First shot will taken after 1 second');
pause(1);
%%%%%%%%%%
for i=1:n
img=getsnapshot(obj);
image(img);
if(photosave == 'y')
outputBaseFileName = sprintf('fr%d.png',i);
outputFullFileName = fullfile(outputFolder, outputBaseFileName);
imwrite(img,outputFullFileName,'jpg');
end
pause(intervel);
end
closepreview;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
pic=img;
im=frame;
t=0.12;
pic_rgb=rgb2gray(pic);
ca=im2bw(pic_rgb,t);
c=~ca;
%Morphology On B&W Image to Detect Location Of Eyes
se=strel('square',1);
eye_dil=imdilate(c,se);
d=imcrop(eye_dil,[110 105 110 33]);
figure(1),
imshow(d),
%%figure(1)
subplot(3,1,1),imshow(pic);
subplot(3,1,2),imshow(eye_dil);
% % For subplot
sumd(1,im)=sum(sum(d));
subplot(3,1,3), plot(sumd);
xlabel('Frame Numbers');
ylabel('Pixel Values');
%for store and decision
sumc1=sum(sum(d));
drowsyFrames =0;
if sumc1<(20)
disp('eye is closed')
% Increment the number of frames where the eye is closed.
drowsyFrames = drowsyFrames +1;
% Check to see if it's been closed for the past 5 frames.
if drowsyFrames >= 5
disp('drowsy')
else
% It's been closed less than 5 frames, so this is a normal eyeblink.
disp('normal')
end
else
disp('eye is open')
drowsyFrames = 0; % Reset counter when the eye is open.
end
disp('The program successfully taken the photos');
disp('Done.');
  댓글 수: 1
Image Analyst
Image Analyst 2013년 5월 27일
I don't have a webcam hooked up to this computer. I suggest you also look in VisionBib for algorithms to see if they do it the way that you do.

댓글을 달려면 로그인하십시오.


KHUSHBU PANCHAL
KHUSHBU PANCHAL 2014년 11월 5일
IT IS NOT WORKING PROPERLY AND GIVING ERROR.. @ pic=img; im=frame;
  댓글 수: 2
kalani ekanayake
kalani ekanayake 2015년 5월 13일
Hi, have you find any solution for this? I'm also looking for doing a similaer thing to detect sleepyness eyes. can you please help me to start with?
Image Analyst
Image Analyst 2015년 5월 13일
kalani, did you see my link where a bunch of papers on drowsiness detection are listed? There is nothing in MATLAB for that so you'll have to write your own using algorithms listed in those papers from lower level MATLAB functions.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by