I’ve been trying to reduce the number of free variables in the mapping between the position of the pupil in a eye-camera image and the point of gaze on a screen, given the head location of a person. Previously I was just fitting an ellipse to the pupil and using the location of its centre. This method did not use all of the information I’d just obtained about the ellipse. In this post I explore one theoretical method of using the ellipse parameters.
We can approximate the eyeball as a sphere with a circle on which corresponds to the pupil. We’ll describe the size of the pupil by the radius of the sphere and the angle between the lines from the centre of the sphere to the centre of the pupil and to any point on the edge of the pupil, see figure 1.
If the eye is looking directly into the camera the pupil will appear to be circular (assuming minimal or corrected camera lens distortion). We will define the center of the pupil in the image plane in this case to be . Since the pupil will appear to be a circle all its axes are equal. The red and the blue lines in figure 1 have the same length. This length can be calculated by:
As the eye turns away for the camera the pupil image will become elliptical. Consider the eye following some line on the image plane which passes through by rotating the eye through an angle in the plane defined by our line and the center of rotation of the eye. The pupil will now appear to be an ellipse with its major axis the same length as before (the red line) but with a shorter minor axis.
The length of the minor axis can be calculated from the internal angles of the quadrilateral to calculate the angle . Note that is the angle BED and is equal to the angle BFC
so we have
We consider it in 3D by just rotating orthogonally to the plane of rotation of .
These two rotations can move to pupil to any place on our model eyeball. There are two nice properties of this circle on a sphere. Firstly the line passing through the minor axis of the ellipse in the image passes through the centre of the eye in the image . This fact means that the center of the eye can be determined from two images of the pupil in different positions by finding the intercept of the two lines defined by the minor axis.
This property allows us to calculate the angle from the angle of the minor axis and the position of the pupil relative to
The second useful property is that can calculate gamma from the ratio of the minor axis.
We can will consider the ratio of the major and minor axes. This measure will be invariant as the pupil size varies.
From this we can directly calculate as follows:
If we have at least two images of the eye we can describe the rotation of the eye by . These angles can be used to generate the unit vector where
These unit vectors then have to be rotated to align with the real world. The rotation matrix can be described by three scalars.
In this analysis we assume that the eye is a sphere, rotating about it center: a fixed point relative to the camera and that we are able to accurately extract the ellipse describing the pupil. We do not consider the effects of noise, error or perspective. I’ve also assumed that the edge of the pupil is always on the edge of the sphere – when in fact it is more like a circle on a plane cutting through the eye (ouch). I have a feeling that this is not a problem as it is equivalent to the eyeball changing size as the pupil changes size.