From: A 2D eye gaze estimation system with low-resolution webcam images
LET S be the rectangular socket region consists of P number of pixels: S1 ... S P |
---|
LET A be a two-dimensional array of pixels |
LET O be the position of the template's origin |
LET AVG be the average intensity of socket region |
LET W be the deformable eyeball model involves N number of template windows: W 1 ... W N |
LET Z be the size of the template window |
LET L be the template window consists of Z number of pixels: L 1 ... L Z |
LET V be the index number of the window where window has the highest intensity variance between current index and previous index. |
LET WIDTH be the width of the input camera image |
LET alpha be the angle between windows |
LET cutOffRatio be the ratio determines the initial index with the highest variance |
in a window which is used for getting rid of eyebrows |
LET epsilon be the tolerance value for eyeball detection LET B be the index of vertex over the border of eyeball |
SET minIntensity TO 256.0f |
FOR EACH i = 1 TO P |
//Start of pixels |
   IF BRIGHTNESS( S i ) <minIntensity THEN |
   SET minIntensity TO BRIGHTNESS( S i ) |
   SET O x TO POSITION( S i )--> x |
   SET O y TO POSITION( S i )--> y |
END IF |
//End of pixels |
END LOOP |
SET alpha TO 0.0f |
SET integralIndices TO 0.0f |
SET integralBrightness TO 0.0f |
FOR EACH j = 1 TO N |
//Start of windows |
   INCREASE alpha BY ( TWO_PI/ N ) |
   SET maxVariance TO 0.0f |
   SET maxAverageIntensity TO 0.0f |
   FOR EACH k = Z TO 1 |
   //Start of indices in windows |
   SET point_x TO O x + k * COS ( alpha ) |
   SET point_y TO O y + k * SIN ( alpha ) |
   SET index TO point_y * WIDTH + point_x |
   SET A[j,k] TO COLOR( S index ) |
   SET variance TO ABS ( BRIGHTNESS( A[j,k] ) - BRIGHTNESS( A[j,k-1] ) ) |
   SET V TO Integer.MAX_VALUE//highest possible value of an integer. |
END IF |
   IF variance>maxVariance AND V>Z/cutOffRatio THEN |
SET maxVariance TO variance |
SET V TO k |
   END IF |
END LOOP |
SET integralIntensity TO 0.0f |
FOR EACH l = V TO 1 //Integrate from the index with the highest variance to the origin's index |
   INCREASE integralIntensity BY ( 255 - BRIGHTNESS( A[j, l] ) ) |
END LOOP |
SET averageIntensity TO ( integralIntensity/l) |
   IF averageIntensity>maxAverageIntensity THEN |
SET maxAverageIntensity TO averageIntensity |
SET B TO V |
END IF |
//End of indices in windows |
END LOOP |
INCREASE integralIndices BY B; |
INCREASE integralBrightness BY BRIGHTNESS( A[j,B] ) |
IF integralIndices/j >epsilon AND integralBrightness /j <AVG THEN |
   ADD B TO ARRAYLIST |
END IF |
//End of windows |
END LOOP |