Eyelid detection. (A) Sample image with the four image sectors containing the eyelid segments. The images within the sector have been filtered with an edge detector. The pixels that are more likely to be part of an edge are labeled as white, and the rest are labeled as black. (B) Result of fitting a parabola (shown in orange) to the eyelid segments. Only pixels within the two parabolas will be considered for tracking the pupil and the iris. (C) Representation of the pupil detection and contour analysis. Pixels in white are pixels above the set threshold. Pixels in yellow are the pixels masked by the eyelids or the reflection of the light-emitting diode on the cornea. Orange dots indicate the smoothed contour of the pupil to fit the ellipse, and green dots correspond with the parts of the contour eliminated due to eyelid or reflection interference. The red cross indicates the centroid of the contour. Finally, the red line shows the fitted ellipse. (D) Sequence of frames during a blink. (E) Example recording of eyelid movements represented by percentage eyelid opening. Eyelid opening is measured as the average distance between the top eyelid segments and the bottom eyelid segments. Orange dots mark the points corresponding with the image frames in panel D. (F) Raw torsion measurement corresponding with panel E. Large spikes correspond with the periods of time the eye is closed, making tracking impossible. Note how quickly stable torsion tracking resumes as the eye opens, even before the eyelids completely open again. (G) Root-mean-square noise in the torsional eye position recordings as a function of percentage of visible pupil.