Eye tracker

Keep your head still. Press Start camera and allow access when the browser asks.

The camera image is analysed in your browser and never leaves it.

Step 1: find your eyes Sit close, with your eyes well lit, and keep your head still. Drag the two boxes over your eyes, or use the sliders.

Left box, enlarged

Left eye: no data yet

Right box, enlarged

Right eye: no data yet

Lower the threshold until only the pupil is red.
Step 2: calibrate
Mapping:

Not calibrated. Find both pupils in step 1, then press Calibrate.

Nine dots appear in turn on the stimulus screen. Look at each one with your head still. Calibrate again whenever the head has moved.
Step 3: track
Stimulus:

Gaze: calibrate first

Fixations: none yet

RegionDwell (s)ShareFixations
Pupillometry
−30 snow

Pupil area: no data yet

Pupil area in camera pixels over the last 30 s. Only changes under constant light and position mean anything.
More about this app

How it works

A webcam, a brightness threshold that finds the pupil, and a short calibration give an estimated gaze point, from which fixations and scanpaths are drawn. Only the files you choose to download leave this page.

Inside each eye box every pixel is converted to grey and compared with the darkness threshold (0–255); pixels darker than the threshold are drawn red. They are grouped into connected blobs, and the largest reasonably round blob is taken to be the pupil, drawn in blue with a cross at its centroid. Eyebrows, eyelashes and the frames of glasses are the usual false pupils.

Calibration records the mean pupil position while you look at each of nine dots, then fits a mapping from pupil position to screen position by least squares. The affine mapping is a stretch, a rotation and a shift; the quadratic mapping can also bend, which helps at the edges but needs cleaner data. The error reported is how well the mapping explains its own calibration data, not how accurate the tracker will be afterwards. Show residuals draws the errors as arrows.

The gaze point is smoothed over the last frames; more smoothing gives a calmer point that lags behind the eye. A fixation is counted when the gaze stays within the dispersion distance for at least the minimum duration. The heatmap adds up how long the gaze rested at each place. On the stimulus the ring is the smoothed gaze point and the circles are fixations, sized by duration and joined by saccades; the table gives the dwell time in each region.

The pupil area grows when you lean towards the camera, shrinks when the threshold cuts off the edge of the pupil, and changes with the camera's own exposure control. Try this: keep still, look at a bright white part of the screen for 10 s, then at a dark part, and watch the area fall and rise. Then look at the dot stimulus and multiply two two-digit numbers in your head; a pupil that widens while the light stays the same is the response to mental effort that pupillometry is after.

Things to try

Calibrate, then look at each corner of the stimulus screen in turn and see how far the ring lands from where you look. Turn your head a few degrees without moving your eyes and watch the gaze point slide away, which is why research systems track the head or the corneal reflection too.

Read the text stimulus and compare the number and duration of fixations with those on the staff notation; then read the notation as if sight-reading it, and look at where the fixations fall relative to the bars.

Switch the mapping between affine and quadratic without recalibrating and compare the errors. Raise the smoothing until the point stops jittering, and note how much later it arrives. Lower the dispersion threshold until a steady gaze breaks into many short fixations, which shows how much a fixation count depends on the detector's settings.

Limits

This page demonstrates the principle of video eye tracking with a webcam and a few lines of image processing. Research eye trackers add infrared illumination, a corneal reflection, far higher frame rates and a model of the eye, so they are far more accurate and tolerate head movement. The numbers here are for understanding the method, not for measuring anyone.