# Design of a Binocular Pupil and Gaze Point Detection System Utilizing High Definition Images
## 2 Proposed Binocular Eye Gaze Tracking System
### Detection of Pupil and Corneal Reflection  
In this design, we grab images with NI PCIe-1473R FPGA frame grabber card located in the PCIe slot of the eye tracker desktop computer. Our software (its interface is shown in Figure 6) reads image frames from the computer's direct memory access (DMA) channels which transfer data from and to the frame grabber. With the DMA, the CPU first initiates the transfer, and then performs other operations while the transfer is in progress. It receives an interruption by the DMA controller when the operation is accomplished. DMA usage provides great convenience such that the CPU does not need to trace data transfer while performing other works. In the beginning of the transferred image frame processing, we created a temporary memory location in the LabVIEW for the image and to save flowing gray level images for processing. After one image frame processing is complete, the memory is evacuated for the next frame. In our design, we considered corneal reflections (first Purkinje reflection) as a reference point for pupil searching. IR passing filter fulfills this step for us. Corneal reflection is called 'glint' [25]. It has the brightest value in the grabbed image, so it is easy to detect. Thus, a captured 10-bit resolution (1-1024) gray level image is firstly transformed into a binary image using Equation (1). \[g(x,y)=\left\{ \begin{array}{ll}1,&f(x,y)>T\\ 0,&f(x,y)<T\end{array} \right. \tag{1}\]  
where,_f_(_x_, _y_) corresponds the pixel value at _x-y_ axis coordinate in the gray level image while _g_(_x_, _y_) is the binary value at _x-y_ axis coordinate of the image after thresholding process. Threshold level (_T_) can be determined by automatically or manually. However, automatic algorithms increase the process time of the image. Therefore, we assumed that the determination of the glint threshold can be made experimentally since glint has high luminance. We manually selected glint threshold value as 1020 after experimental trials. Then, component labeling was applied to the segmented parts from background image. Small-sized parts were removed from the image to clear rough right and left eye glints with erosion operation utilizing morphological filter. These filters give the capability to ignore the objects smaller or larger than given sizes. We removed objects smaller than 15 pixels using the filter. To find the center coordinates of corneal reflections, we used a weighted average technique which is implemented faster than elliptic and circular shape center detection methods. The weighted average is found by multiplying the location of the pixel by its value and then dividing it by the number of pixels in the labelled corneal reflection mass as in Equation (2) where \(x\) and \(y\) are the position of the  
Figure 6: User interface menu of the LabVIEW-based eye tracker. pixel and \(I(x,y)\) is the pixel value, respectively. In addition, \(w\) represents the width of the image and \(h\) represents the height of the image in pixels. The results are \(x^{\prime}\) and \(y^{\prime}\)-central coordinates for each glint. \[x^{\prime}=\frac{\sum_{x=0}^{w}\sum_{y=0}^{h}xI(x,y)}{\sum_{x=0}^{w}\sum_{y=0}^ {h}I(x,y)},\ \ y^{\prime}=\frac{\sum_{x=0}^{w}\sum_{y=0}^{h}yI(x,y)}{\sum_{x=0}^{w}\sum_{y= 0}^{h}I(x,y)} \tag{2}\]  
It is likely that pupils are close to glints. After detection of the glints' centers, we defined a 100 \(\times\) 100 pixel square ROI area. Its center coordinates are same as the coordinates of the glint centers. Then, we extracted ROI area in the raw gray level image and saved it in the memory. Glint detection image processing steps are also applied when detecting center coordinates of the pupil. Because pupils have the darkest value and the largest object in the extracted image, it is easy to detect them. Thus, a captured 10-bit resolution (0-1024) gray level image is transformed into a binary image using Equation (1). Extracted ROI area image histogram values were measured for 11 users and we saw that small differences occurred.