# An Image Processing-Based Method to Analyze Driver Visual Behavior Using Eye-Tracker Data
## 3 Methodology
### Image Processing  
There are four types of representations to show the pixels of an image: grayscale, binary, color (RGB), and indexed color. A grayscale or binary pixel has one data value, and a color pixel has three data values (each for one of the color channels). Additionally, an indexed color image has one data value per pixel, which is an index for a color map. The frames collected by the world camera were picked to be evaluated to compare gaze positions and road borders to identify the driver's gaze position and whether it was inside or outside the road limits during the driving session. Figure 5 proposes one frame with the point of the gaze (the red dot in the center of the green circle). To determine the road borders in the image, first, the RGB image was converted into a grayscale image, and then the Canny algorithm ([PERSON], 1986) [51] was used to detect the edges in the image, which also included the borders of the road. Figure 6 shows an example of an image frame after it has been converted from an RGB image to a grayscale image. The Canny algorithm was applied to each extracted image, and the locations with a significant color shift in the images were detected. It is a function that searches for local maxima of the gradient of the input image to detect edges. This approach detects solid and weak edges using two thresholds and includes weak edges in the output if they are related to solid edges. The Canny approach is less likely than other methods to be deceived by noise and more likely to detect actual weak edges, thanks to the use of two thresholds. However, this study utilized the Canny edge detection algorithm with a single threshold value to identify and include solid edges in the output binary image. This threshold value was selected based on the maximum edge strength that should result in a grayscale image. Consequently, any edge with a strength greater than the chosen threshold value was considered a solid edge and included in the output image. The driver gaze position was acquired after converting the gaze positions from 2D normalized to 2D image space (Section 3.3). \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline  & \multicolumn{2}{c}{**Driver \#1**} & \multicolumn{2}{c}{**Driver \#2**} & \multicolumn{2}{c}{**Driver \#3**} & \multicolumn{2}{c}{**Driver \#4**} \\ \cline{2-9}
**Segments** & **\# of Total** & **\# (\%) of Analyzed** & **\# of Total** & **\# (\%) of Analyzed** & **\# of Total** & **\# (\%) of Analyzed** \\  & **Frames** & **Frames** & **Frames** & **Frames** & **Frames** & **Frames** & **Frames** \\ \hline Segment 5, Rectilinear & 443 & 96 (22\%) & 734 & 133 (18\%) & 650 & 135 (21\%) & 579 & 113 (20\%) \\ Segment 2, Curvilinear & 187 & 30 (16\%) & 296 & 27 (9\%) & 109 & 24 (22\%) & 232 & 22 (9\%) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Statistics of total vs. functional and analyzed eye-tracker video camera frames. Figure 5: This is an example of the frame image before processing. The red dot inside the green circle (pointed by the black arrow) represents the gaze. Figure 6 illustrates a processed image of a frame from a world movie with all identified edges and the driver's gaze location. The Canny algorithm generates a binary picture filled with 1 and 0 values. The pixels with value 1 in the frame are known as image edges; these are the image portions where color transitions occur. Here, we explain the algorithm used to pinpoint the gaze. The primary hypothesis is that the gaze refers to a point on a plane belonging to a relatively wide object; this object can be the road surface, a vertical sign, a building facade, or a generic wall. The images from the simulation are in 2D, so we need further information to obtain the third dimension. This is achieved by using the buildings whose bases, in our scenario, lie on the same road plane. We use the same binary picture generated by the Canny algorithm to determine the basis of buildings.