Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.