# An Image Processing-Based Method to Analyze Driver Visual Behavior Using Eye-Tracker Data
## 3 Methodology
### Image Processing
We identify three prominent cases shown in Figure 6:  
(a) The gaze is inside the road; the roadside y-coordinates are the same as the gaze;  
Figure 6: The three cases considered to pinpoint the gaze (the red dots and circles magnified on the right) are as follows: (**a**) the gaze is inside the road; (**b**) the gaze is outside the road, and there are no buildings; and (**c**) the gaze is outside the road on the facade of a building. 2. The gaze is outside the road, and there are no buildings. The roadside y-coordinates (in the frame space) are the same as the gaze. Some errors may be inserted due to perspective distortions, especially if the gaze is far from the road;
3. The gaze is outside the road, on the facade of a building; the projection of the gaze on the base of the building and the roadside y-coordinates are the same. Some errors may be inserted due to the inaccurate definition of building boundaries, especially when shades hide them. A selection window was created to choose the road borders from the image's edges. Its size must be large enough to include only the roadsides, and the height must be as small as possible to avoid errors in detecting the y-coordinates. However, the driver's perspective is influenced by various factors such as head movement, vehicle position, and orientation, which makes it challenging to maintain a consistent selection window. To overcome this issue, the selection window was designed to adjust to the constant shifts in the driver's perspective. The selection window's size and placement were kept as consistent as possible to evaluate more frames with proper road border coordinates. Despite the efforts to keep the selection window consistent, maintaining the same window in curvilinear segments of the circuit is hindered by the significant shift in the driver's view caused by the road curvature radius. A larger radius of curvature leads to a more significant shift in the driver's viewpoint. The flow chart in Figure 7 reports the image processing procedure executed on each frame to detect the road borderlines. Another critical issue that should be addressed for some of the frames, particularly in the curvilinear segments, is that sometimes the roadsides are not included in the driver's view because the vision of one or both of the road boundaries is entirely covered by the frame of the front and left or right windows of the vehicle, and other times by the side-view mirrors of the vehicle. In these situations, capturing the road boundary coordinates is impossible due to visibility limitations. Since there was no way to discern one of the road borderlines or both, these frames were not included in the analysis. As mentioned, many elements affect the driver's perspective, including head movement, curvature radius, vehicle location and orientation along the circuit path, and so on. Detecting points on the road borderlines is impossible due to either a blockage by the vehicle's window frames or the absence of one of the road borderlines in the image due to the driver's perspective (Figure 8). Figure 7: Flowchart of a summary of the image processing procedure for the detection of road borderlines.