# Eye Blink Detection Using Computer Vision

I am working on a eye blink detection project in Matlab. By this moment I have been successfully extracted the images of pupil of eye from the real time video captured via a web cam.

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/actual images extracted from the program on which image processing is to be done.)

• What methods have you tried? By simply looking at your samples, I think image difference should work assuming you can correctly segment "eye" area. Mar 24, 2014 at 19:46
• till now i have used mean intensity method to calculate values for a image, but it is not coming accurate under different set of environments, as lighting conditions for the image changes. and also it is a realtime program so storing images and then calculating the image difference would certainly increase its response time which is undesirable. Mar 26, 2014 at 7:34
• and i have been able to correctly segment the eye area using my program and the above attached images have been segmented using the code itself. could you suggest me any matlab image processing function/algorithm that i should try on the above set of images. Mar 26, 2014 at 7:41
• meanIntensity=mean2(pic); if meanIntensityValue>60 disp('Eye Closed') else disp('Eye Open') end using this algorithm but results get inaccurate during differnt light surroundings. Mar 26, 2014 at 7:52
• A blink is a rapid change in intensity for a short period. Rather than absolute thresholds, how about looking for small spikes in intensity. May 5, 2014 at 21:35

You probably should take the Deep Learning approach in this case as it makes things almost trivial.

To have this integrated into MATLAB you may use Yuval Nirkin's find Face Landmarks project.
What you need is to replicate the Python calculation:

Which is implemented using the Eyes Landmarks:

• That was 2014, you can understand from MATLAB reference in the question. Now we have multiple options to do this. :) Jul 6, 2023 at 7:15
• @Vikas, Hence you either should accept the answer or post your own solution and mark it as the solution. For the community :-).
– Royi
Jul 6, 2023 at 7:24
• As this doesn't answer the question as it is in MATLAB. thanks for the efforts. Jul 6, 2023 at 7:45
• @Vikas, All the tools there are available on MATLAB: mathworks.com/matlabcentral/answers/415029. Just replace the Python Code with MATLAB or just run the Python from MATLAB (It is supported).
– Royi
Jul 6, 2023 at 8:22
• If you want simpler integration, you may use: github.com/YuvalNirkin/find_face_landmarks.
– Royi
Jul 6, 2023 at 8:25