Eye pupil tracking
CS-160: Software Engineering
Instructor: Rob Bruce
Fall 2016

SLIDE 1: Eye physiology: pupil

Color image of a human eye with an arrow pointing to the pupil.

Modified from source: https://commons.wikimedia.org/wiki/File:Human_eye_with_blood_vessels.jpg

SLIDE 2: Eye physiology: iris

Color image of a human eye with an arrow pointing to the iris.

Modified from source: https://commons.wikimedia.org/wiki/File:Human_eye_with_blood_vessels.jpg

SLIDE 3: Eye physiology: sclera

Color image of a human eye with an arrow pointing to the sclera.

Modified from source: https://commons.wikimedia.org/wiki/File:Human_eye_with_blood_vessels.jpg

SLIDE 4: Eye physiology: eye corners

Color image of a human eye with an arrow pointing to the lateral canthus and another arrow pointing to the medial canthus.

Modified from source: https://commons.wikimedia.org/wiki/File:Human_eye_with_blood_vessels.jpg

SLIDE 5: Eye physiology: upper and lower eyelids

Color image of a human eye with an arrow pointing to the palpebra_superior and another arrow pointing to the palpebra_inferior.

Modified from source: https://commons.wikimedia.org/wiki/File:Human_eye_with_blood_vessels.jpg

SLIDE 6: Bounding box: restrict your search

Color image of a human eye with a rectangle drawn from left to right eye corners and upper to lower eyelids.

Modified from source: https://commons.wikimedia.org/wiki/File:Human_eye_with_blood_vessels.jpg

SLIDE 7: Search for the pupil

  1. Convert image to grayscale.
  2. Crop original image to bounding box region.
  3. Create gradient vectors from light to dark pixel regions.
  4. Look for radial gradient vector patterns.
Grayscale image of a human eye cropped from left to right eye corners and upper to lower eyelids.

Modified from source: https://commons.wikimedia.org/wiki/File:Human_eye_with_blood_vessels.jpg

SLIDE 8: Pupil found!

Grayscale image of a human eye cropped from left to right eye corners and upper to lower eyelids with arrows eminating radially from the center of the pupil. The arrows represent gradient vectors.

Modified from source: https://commons.wikimedia.org/wiki/File:Human_eye_with_blood_vessels.jpg

SLIDE 9: constants.h

  • kFastEyeWidth = 100
  • Good working value is 100.
  • A value of 200 is slow but smooth.
  • A value of 300 takes 62 seconds to process per frame (both eyes included).
  • A value of 400 gets really slow!

SLIDE 10: Video demo

SLIDE 11: For further reading…