trishume / eyeLike

A webcam based pupil tracking implementation.
MIT License
917 stars 335 forks source link

Check if eyes are closed #2

Open aznn opened 10 years ago

aznn commented 10 years ago

Can this be used to check if the eyes are closed?

trohit920 commented 5 years ago

@trishume Can we use this for calculating eye blinks or simply for checking eye closing? @AeonAxan How did you solve this problem. Any help will be appreciated.

trishume commented 5 years ago

It kind of can, not sure how well it would work compared to other possible solutions. Basically the algorithm produces a "centre-ness map" and instead of finding the highest point you look at the maximum value over time, and when the maximum value is low then it probably doesn't see the iris/pupil.

Joshua27 commented 5 years ago

I think you would probably detect a lot of false positives when using eyeLike for blink detection. Of course, this depends on the illumination and the chosen metric which classifies maximum values to be "low" compared to previous values. Another problem of this approach could be that the eyes might be initially closed leading to a corrupted sequence of maximum values. @trohit920 I think it is a better approach to use facial landmark detection and compute the eye aspect ratio in order to detect eye blinks. For instance, here you can find a good tutorial: https://www.pyimagesearch.com/2017/04/24/eye-blink-detection-opencv-python-dlib/

trohit920 commented 5 years ago

@trishume Hey i want to know how can i check the maximum value. So when i tried closing my eyes, from visualization i can see that eyebrows are detected as pupil. I just want check what happens when eyes are closed.

trishume commented 5 years ago

Sorry, it's not a beginner task. Please try to figure it out yourself by reading the code. For example the maximum value is in that file as maxVal.

trohit920 commented 5 years ago

@trishume Thanks for your response. I already checked output of maxVal. But it seems to give same value for both pupil and eyebrows. I also cropped eye extraction in such a way that it only have eyes in side but then when i close my eyes, pupil appears on closed eye lashes.

trishume commented 5 years ago

Yah sounds like you're probably better off using facial landmark detection.

trohit920 commented 5 years ago

@Joshua27 @trishume Thanks for your comments. I tried Dlib facial landmark detector for detecting landmarks and hence checking eye closing and opening using eye aspect ratio. But sometimes when eyes are closed landmark detector still detect it as open as it still finds an eye shape on closed eye lids. Also trained my own 31 point landmark detector but same issue appears. Please share your thoughts if something else can be done in eyeLike to check eye opening and closing or any other advice.

trishume commented 5 years ago

I'm not sure. I've never tried to do closed eye detection. If you could get a dataset maybe a simple machine learning CNN classifier would do the trick.