Eye detection is hard enough, closed eyes harder as they are relatively featureless compare to eyes. I suppose You could take the approach of detecting open eyes then tracking them when they close but this doesn't suit all scenarios.
That said, [partial] facial detection is a full AI project in any case. If you search in the messages Q&A sections you'll see we get several questions about this sort of thing every year curiously around student project time :). I suggest you try the following:
- You find some third party code that does what you want or reduces the problem down to something manageable.*
- You find another strategy to do what you want (why eyelids btw, to see if someone is asleep?)
- You get another project
* I think Micrsoft Kinect has facial detection sotware and an SDK you can use (I've never tried it so YMMV). There are third party systems for facial detection using a webcam etc. Some webcams support this out the box.
I don't mean to be so down on your project, getting this to work properly is hard
and it is better to get third party support to do this or change your project before it becomes too late. Hope this helps.