Image Analysis Help for Eye blink detection

I am working on a eye blink detection project. By this moment I have been successfully extracted the images of pupil of eye from the real time video.
But I am stuck at the process to differentiate the open eye pupil to the closed eye lid state.
1. Open eye pupil
2. closed eye lid
Could you please suggest me any image processing function or algorithm to differentiate between the two states.
(Attached images are the original images on which image processing is to be done.)

2 Comments

actually i want to get a value which can be used to decide the state of eyes.
i am trying to do it by
newIm2= im2bw(eyeImage,0.4);
B = bwboundaries(newIm2,8,'noholes');
L= length(B);
after this comparing "L"... as it would be different for eye open and closed state.
but the above algorithm is not working. please help
Hello VIkas,
Can you share the code of eye detection and pupil ext6raction plz.

Sign in to comment.

 Accepted Answer

You can have a plot of average horizontal intensities.In case eye is closed the distance between two deep valleys would increase as eyelashes would move far from the brows:
I1 = imread('openEyeImage');
I1 = rgb2gray(I1)
plot(1:size(I1,1) , mean(I1,2));
hold on
I2 = imread('closeEyeImage');
I2 = rgb2gray(I2)
plot(1:size(I2,1) , mean(I2,2) , 'r');
Check out the difference between two plots.
Or you can go from blob detection, find circular objects. Call regionprops check out for ecentricity. This would be useful: Blobs Detection

7 Comments

Vikas
Vikas on 18 Mar 2014
Edited: Vikas on 18 Mar 2014
I actually want to get a value for different states, so that i can proceed further to detect the drowsy state of driver if it detects continuously 4 times closed eyelids.
could you tell me how to get a specific value for the two states? As in the plot method I am unable to compare the values.
i am trying to do it by
newIm2= im2bw(eyeImage,0.4);
B = bwboundaries(newIm2,8,'noholes');
L= length(B);
after this comparing "L"... as it would be different for eye open and closed state.
but the above algorithm is not working. please help
As you can see from the plot distance between first two deep valleys(local minima) would be more for a closed image. You can set a threshold distance to check out weather image is closed. You can locate minima using findpeaks
horizontalAverages = mean(I1 , 2);
plot(1:size(I1,1) , horizontalAverages)
[Minimas locs] = findpeaks(-horizontalAverages)
hold on
plot(locs , -1*Minimas , 'r*')
if (locs(2)-locs(1))< threshold %Threshold distance
% Eye is open
else
% Eye is closed.
And I dont think bwboudaries will do,as L will number of objects and that might vary due to imperfections in imaging.
i am getting following output
1)Eye open state
----------plot for various open eye images
2)Eye Closed state
----------plot for various closed eye images
You can see the pattern mimimas are located far when eye is closed. You can choose a threshold based on these patterns.
Greetings, Mr. Dishant. May I know what is the name of this method? I would like to read a few papers regarding this method since I'm doing a research on eye blink detection. Thank you.
I think it's usually called "drowsiness detection". See my Answer for a link to published papers on it.

Sign in to comment.

More Answers (2)

4 Comments

can you suggest any matlab image processing algorithm or function to be applied on the actual images which are generated/extracted through the program.
1. Open eye pupil
2. closed eye lid
I'm sure several of the papers suggest algorithms. I'm sure what I would suggest for your one subject (such as looking at the mean intensity or the average radial profile) might work okay for that one pair of images but mgiht fail in other cases, like for very very dark skinned individuals. That's why I suggested published algorithms where presumably they've considered those things and made their algorithm very robust.
I'm unable to view the IEEE or Science direct papers as i have not subscribed for their membership.
It would be great if you can suggest for above images as it would give me an approach on how to deal with it, would be able to try that on different subjects.
If you're at a University, the papers will be available for free most likely. If you work for a company they will spend less money to order papers than paying you to flounder for months trying different, unproven approaches.
I did give two approaches (radial profile or mean). Try to program those up.

Sign in to comment.

After reading an image (jpeg, png, etc.), then I want to detect eyes and find the distance between human eyes. So if anyone have such a code then please inbox me (<mailto:waheedullah356@gmail.com waheedullah356@gmail.com>) or give here. Thanks.

1 Comment

There is a thing which call creativity. I think instead of asking codes from others, use the sample codes above and find your way. For sure there are difficulties to find out the others' coding but in that moment you figure out the way of writing codes, you can do whatever that you want.

Sign in to comment.

Categories

Find more on Automotive in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!