Ask Your Question

Best way to detect that eyes are closed.

asked 2013-07-29 11:33:46 -0500

MattiasR gravatar image

What is the best way to detect that eyes are closed or open? I currently use haar to detect face. second step i flandmark to find "exact" position of one of the eyes.

When I have the position of the eye I extract it and use some nice opencv methods.

The results:

Open eye:

image description

closed eye:

image description

The images are enlarged (3x), and are not that blurry in reality.

Is there any nice way to continue from here to distinguish between an open eye and closed eye?


edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-07-29 11:48:24 -0500

ximobayo gravatar image

updated 2013-07-29 11:53:39 -0500

Try with matchtemplate with normalized cross correlation I think there will be a big difference comaparing the both. So you can set a minimum threshold.

edit flag offensive delete link more

answered 2013-07-29 13:14:53 -0500

Notas gravatar image

Matchtemplate/Crosscorrelation isn't that great when you have black/white images, grayscale is better for it.

In your case, I see a big differene in the images of open/closed eyes: A closed eye has the form of a line, while an open eye is more or less square.

What you can do is count the number of rows and columns that have black pixels in them. For the open eye, you get for example 12 rows and 15 columns. Divide the smaller by the bigger number and you get a quotient that will tell you how square the eye is. For your closed eye, that value should be near 1.

On the other hand, the closed eye has for example 5 rows and 17 columns, which gives you the quotient 0.29. So you just have to find a threshold that you use to tell if an image is closed or not.

edit flag offensive delete link more

Question Tools


Asked: 2013-07-29 11:33:46 -0500

Seen: 2,136 times

Last updated: Jul 29 '13